Newsgroups: comp.lang.c Path: utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: C Style (Was Re: == vs =) Message-ID: <8804241927.AA19090@champlain.dgp.toronto.edu> Organization: University of Toronto References: <11216@brl-adm.ARPA> <2111@chinet.UUCP> <4403@garfield.UUCP> <226@hotlr.ATT> <130@obie.UUCP> <5981@utcsri.UUCP> <1982@ubc-cs.UUCP> <126@atpal.UUCP> <2823@mmintl.UUCP> <255@oink.UUCP> <10535@steinmetz.ge.com> Date: Sun, 24 Apr 88 14:07:13 EDT People complaining recently that "if(expr == TRUE)" is ridiculous have missed the most convincing reason as to why it is ridiculous. Note that we are assuming that expr is a boolean expression in the Indian-Hill-C-Style-Manual-as-annotated-by-Henry-Spencer sense that it is known to evaluate to one of 0 or 1. The clearest reason why "if(expr == TRUE)" is ridiculous is simply that such a test begs the question. Certainly "expr == TRUE" returns a boolean result, so if it is necessary to test boolean results in this fashion then we must write "if((expr == TRUE) == TRUE)"! And so on, making the expression infinitely large, which is explicitly prohibited by the ANSI C standard. ajr -- "The goto statement has been the focus of much of this controversy." -- Aho & Ullman, Principles of Compiler Design, A-W 1977, page 54.