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!news.glorb.com!solnet.ch!solnet.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 -- OT Date: Thu, 18 Jan 2007 10:03:09 +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 1169110990 5727 137.138.37.241 (18 Jan 2007 09:03:10 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Thu, 18 Jan 2007 09:03:10 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061220) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:8246 Date: 2007-01-18T10:03:09+01:00 List-Id: Cesar Rabak wrote: >>> if (a = 1) { >>> if (a == 1) { >> No need for separate tools, gcc -Wall issues an informative warning. >> And you do compile with -Wall, right? >> > Not all C code is compiled [only] with gcc... If you use another compiler and it does not provide the functionality that you have for free from gcc, you should certainly report this complaint to the vendor. More to this, if you are at least moderately serious about robustness of your code, I'd expect that you compile it (or at least its isolated critical parts) with a *set* of compilers (the fact that gcc is free makes it an easy candidate) to get as much feedback as you can. Preferably on a regular basis, nightly build or such. If your working environment is so constrained that you don't even run noghtly builds on a set of compilers, you can always write a simple Perl/Tcl/Python/awk/grep/whatever script that will highlight such constructs - just look for if and = that comes in the subsequent pair of parentheses. Note also that in C++ the above constructs are both legal provided that the following two are true: 1. assignment operator returns something ... 2. ... that is implicitly convertible to some fundamental type. These two points already give you many opportunities to guard against such mistakes. In general - I totally understand your points, but I don't count them as showstoppers. And coming back to Ada - can you believe that when I write Finalise instead of Finalize, it is legal but does not do what I want? Unbelievable. Any compiler options for this? ;-) (I know - in some future I will be able to enjoy the override keyword.) -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/