From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f822ae7b0f7433c1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Translating an embedded C algorithm Date: Wed, 17 Jan 2007 14:48:34 +0100 Organization: CERN News Message-ID: References: <1168871816.263502.212100@11g2000cwr.googlegroups.com> <45ace573$1_3@news.bluewin.ch> <68qioe.mes.ln@hunter.axlog.fr> <1168963927.396654.169380@s34g2000cwa.googlegroups.com> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: cernne03.cern.ch 1169041715 10852 137.138.37.241 (17 Jan 2007 13:48:35 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Wed, 17 Jan 2007 13:48:35 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061220) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:8223 Date: 2007-01-17T14:48:34+01:00 List-Id: Cesar Rabak wrote: > Would you believe that: > > if (a = 1) { > Is semantically valid C, but because it is very easy to mistake this > when the intended was: > > if (a == 1) { > That there are tools to look for and signal this!? No need for separate tools, gcc -Wall issues an informative warning. And you do compile with -Wall, right? If you are not comfortable with the above problem, consider this: if ($a = $b) { ... if ($a == $b) { ... if ($a === $b) { ... All three are legal in PHP and have different meaning. Now *that* is funny. ;-) BTW - if just parentheses in C are problematic for anybody, I recommend some Lisp or Scheme exercise for better perspective... :-) -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/