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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f822ae7b0f7433c1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!news.germany.com!aioe.org!not-for-mail From: Cesar Rabak Newsgroups: comp.lang.ada Subject: Re: Translating an embedded C algorithm Date: Tue, 16 Jan 2007 15:12:44 -0200 Organization: Aioe.org NNTP Server 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: zEJK12x7djBBvRARhduGQA.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org In-Reply-To: User-Agent: Thunderbird 1.5.0.8 (X11/20061109) Xref: g2news2.google.com comp.lang.ada:8183 Date: 2007-01-16T15:12:44-02:00 List-Id: Ludovic Brenta escreveu: > Jean-Pierre Rosen a �crit : >>> A question: I see all the time things like "if (.. < ..)" in C - are the >>> parentheses required there ? >> Yes, they are - because C has no "then" keyword. There must be something >> to tell the compiler where the expression ends... > > Not to mention that the parentheses may contain several expressions > separated by the comma operator, some or all of which may have side > effects, and only the last of which actually controls the if > statement... for example: > > if (a = 1, b = a, c = --a, (a = --b) == c) { > ... > } > > Ah, the joy of obfuscated programming :) :) :) > 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!?