comp.lang.ada
 help / color / mirror / Atom feed
From: Cesar Rabak <csrabak@yahoo.com.br>
Subject: Re: Translating an embedded C algorithm -- OT
Date: Thu, 18 Jan 2007 20:18:52 -0200
Date: 2007-01-18T20:18:52-02:00	[thread overview]
Message-ID: <eoork3$t9v$1@aioe.org> (raw)
In-Reply-To: 

Maciej Sobczak escreveu:
> 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.

It is arguable something to try but not a thing the vendor would be 
obliged to.

> 
> 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. 

With embedded work this approach brings a lot of problems on the side. 
If you work for a rich enough company that can afford more than a vendor 
for the compiler, the problems are bearable, but even so many (most of 
them on non standard header names and so on).

Attempting to check C source code intended for some MCU with hosted 
compilers (ca. 15 yrs ago the company I worked had some guys that tried 
that using Turbo C) opens a can of worms about the header files and the 
constants, macros, etc.

In the last chapter of a soap opera, management had to forbid due the 
ammount of #ifdefs in code and vendor supplied files.

Then (PC) Lint came to scene!

> 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.

For that single one, yes, for a lot of idiomatic symptoms worth looking, 
in a moderate size shop buying some licenses for lint or using LCLint 
(a.k.a. Splint) which is FOSS, is better.

> 
> 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.
 >

OK. But C++ in embedded work still is not as widespread.
> In general - I totally understand your points, but I don't count them as 
> showstoppers.

I agree. The showstoppers belong to the management [dept.]!

> 
> 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? ;-)

Yes. Sinc I'm a non native English speaker I _do_ know what you're 
writing about!

> 
> (I know - in some future I will be able to enjoy the override keyword.)
> 

Probably sooner than you might expect!



  parent reply	other threads:[~2007-01-18 22:18 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 14:36 Translating an embedded C algorithm Talulah
2007-01-16  0:06 ` Jeffrey Carter
2007-01-16  1:10   ` Marc A. Criley
2007-01-16  2:21   ` Cesar Rabak
2007-01-16 10:40     ` Markus E Leypold
2007-01-16 14:48       ` Larry Kilgallen
2007-01-16 17:32     ` Jeffrey Carter
2007-01-16 18:04       ` Cesar Rabak
2007-01-17  0:09         ` Jeffrey Carter
2007-01-17  1:07           ` Cesar Rabak
2007-01-16  4:37   ` Alexander E. Kopilovich
2007-01-16 13:37     ` Cesar Rabak
2007-01-16 23:47     ` Simon Wright
2007-01-17  1:02       ` Cesar Rabak
2007-01-16  3:50 ` Vo, Anh (US SSA)
2007-01-16 12:15   ` Niklas Holsti
2007-01-16 23:50     ` Simon Wright
2007-01-18 16:17     ` Niklas Holsti
2007-01-18 16:41       ` Ludovic Brenta
2007-01-18 20:02         ` Niklas Holsti
2007-01-18 22:25         ` Cesar Rabak
2007-01-19  8:32           ` Niklas Holsti
2007-01-19 19:15             ` Cesar Rabak
2007-01-19 20:49             ` Simon Wright
2007-01-18 16:55       ` Robert A Duff
2007-01-18 18:54         ` Jeffrey Carter
2007-01-19  0:45           ` Robert A Duff
2007-01-18 21:25         ` Niklas Holsti
2007-01-19  0:50           ` Robert A Duff
2007-01-19  4:43           ` Jeffrey Carter
2007-01-18 18:43       ` Jeffrey Carter
2007-01-18 20:19         ` Niklas Holsti
2007-01-18 20:30       ` Niklas Holsti
2007-01-18 23:34       ` Cesar Rabak
2007-01-19  8:57         ` Niklas Holsti
2007-01-19  2:11       ` Steve Whalen
2007-01-19 10:27         ` Niklas Holsti
2007-01-16 13:32   ` Cesar Rabak
2007-01-16 14:47   ` Gautier
2007-01-16 15:15     ` Cesar Rabak
2007-01-16 15:16     ` Jean-Pierre Rosen
2007-01-16 16:12       ` Ludovic Brenta
2007-01-16 17:10         ` Georg Bauhaus
2007-01-16 22:32           ` Ludovic Brenta
2007-01-17 20:22             ` Georg Bauhaus
2007-01-18  9:23               ` Ludovic Brenta
2007-01-16 17:12         ` Cesar Rabak
2007-01-16 17:20           ` Frank J. Lhota
2007-01-16 18:09             ` Cesar Rabak
2007-01-16 17:36           ` Dmitry A. Kazakov
2007-01-16 18:08             ` Cesar Rabak
2007-01-16 18:48               ` Dmitry A. Kazakov
2007-01-16 20:03                 ` Cesar Rabak
2007-01-18 19:33                   ` Björn Persson
2007-01-18 22:32                     ` Cesar Rabak
2007-01-19 20:26                       ` Björn Persson
2007-01-19 23:25                         ` Cesar Rabak
2007-01-19  7:15                     ` Maciej Sobczak
2007-01-19 20:27                       ` Björn Persson
2007-01-19 20:34                         ` Robert A Duff
2007-01-17 13:48           ` Maciej Sobczak
2007-01-17 23:32             ` Translating an embedded C algorithm -- OT Cesar Rabak
2007-01-18  8:56               ` Talulah
2007-01-18 22:05                 ` Cesar Rabak
2007-01-18  9:03               ` Maciej Sobczak
2007-01-18 10:22                 ` Alex R. Mosteo
2007-01-18 18:34                 ` Jeffrey Carter
2007-01-18 22:26                   ` Cesar Rabak
2007-01-19  4:45                     ` Jeffrey Carter
2007-01-18 22:18                 ` Cesar Rabak [this message]
2007-01-19 20:53                   ` Simon Wright
2007-01-16 15:55   ` Translating an embedded C algorithm Cesar Rabak
2007-01-17  3:00     ` Vo, Anh (US SSA)
2007-01-17 10:48       ` Cesar Rabak
2007-01-17 11:44       ` Niklas Holsti
2007-01-17 13:31         ` Talulah
2007-01-17 19:20           ` Jeffrey Carter
2007-01-18 14:19             ` Talulah
2007-01-18 15:28               ` Jean-Pierre Rosen
2007-01-18 23:27                 ` Cesar Rabak
2007-01-18 18:51               ` Jeffrey Carter
2007-01-18 22:30                 ` Cesar Rabak
2007-01-19  4:48                   ` Jeffrey Carter
2007-01-19 19:13                     ` Cesar Rabak
2007-01-20 20:56                       ` Jeffrey Carter
2007-01-19  2:21                 ` Alexander E. Kopilovich
2007-01-19  3:25                   ` Larry Kilgallen
2007-01-20  0:46                     ` Alexander E. Kopilovich
2007-01-20 13:03                       ` Larry Kilgallen
2007-01-20 16:54                         ` Alexander E. Kopilovich
2007-01-20 23:53                           ` Larry Kilgallen
2007-01-20 21:02                         ` Jeffrey Carter
2007-01-25 21:59                     ` Markus E Leypold
2007-01-26  4:06                       ` Larry Kilgallen
2007-01-26 11:26                         ` Markus E Leypold
2007-01-26 12:25                           ` Cesar Rabak
2007-01-19  4:52                   ` Jeffrey Carter
2007-01-19 10:13                   ` Warner BRUNS
2007-01-19 14:54                   ` Robert A Duff
2007-01-19  4:08 ` Steve
2007-01-19 20:41   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox