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=-0.3 required=5.0 tests=BAYES_00, 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-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!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Translating an embedded C algorithm Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> <11e7vht8gdl0z$.2dypcyr85i3w.dlg@40tude.net> Date: Tue, 16 Jan 2007 19:48:17 +0100 Message-ID: <147rcq0tjavdf.lzroutxxh59k$.dlg@40tude.net> NNTP-Posting-Date: 16 Jan 2007 19:48:12 CET NNTP-Posting-Host: 17591265.newsspool4.arcor-online.net X-Trace: DXC=XV;Sa9NX083kUFX=Y?aLP;4IUKFLX:;mXN_e?9S@3oe]A;C1 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8197 Date: 2007-01-16T19:48:12+01:00 List-Id: On Tue, 16 Jan 2007 16:08:21 -0200, Cesar Rabak wrote: > Dmitry A. Kazakov escreveu: >> >> There is a good C-style rule for that. Place all constants on the left, >> i.e. >> >> if (1 = a) { // Compile error >> >> Another advantage is that constant expressions are usually shorter, so it >> becomes more readable as well. >> > Not always the assigment or comparison is being done against a constant, Yes, but it makes 80% of the cases. Interestingly, but I have a feeling that in Ada programs there is somehow less comparisons like above. Maybe because of use of enumeration types and case-statements? > so this is an advance, but still does not avoid all mishaps. Yes, it does not, but it reduces risk. A further step could be switching to Ada... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de