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=3.0 required=5.0 tests=BAYES_00,FROM_WORDY, PP_MIME_FAKE_ASCII_TEXT,REPLYTO_WITHOUT_TO_CC autolearn=no 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!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.rcn.net!news.rcn.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 16 Jan 2007 11:20:32 -0600 Reply-To: "Frank J. Lhota" From: "Frank J. Lhota" Newsgroups: comp.lang.ada 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> Subject: Re: Translating an embedded C algorithm Date: Tue, 16 Jan 2007 12:20:32 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Response Message-ID: NNTP-Posting-Host: 209.6.187.224 X-Trace: sv3-SagTuOUu4RQuXAQqGg1tvPToewzHYer1uBb9e1Hb++B8sc3T2hhbCX8PGODeSDdpm5NXl02G7XSrey8!tPRwHI1PxG0LqWQtNT89bt/UxiOiX3p2OVpPqwrgeKvZq7KgybL+eBP+6E0BOacnCR3fbUWX87RU!8Q== X-Complaints-To: abuse@rcn.net X-DMCA-Complaints-To: abuse@rcn.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8185 Date: 2007-01-16T12:20:32-05:00 List-Id: "Cesar Rabak" wrote in message news:eoj0u8$148$1@aioe.org... > 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!? A lot of C compiler will warn you about constructs such as if (a=1) { ... }