Re: Translating an embedded C algorithm -- OT
- From: Maciej Sobczak <no.spam@xxxxxxxxxxx>
- Date: Thu, 18 Jan 2007 10:03:09 +0100
Cesar Rabak wrote:
if (a = 1) {
if (a == 1) {
No need for separate tools, gcc -Wall issues an informative warning.Not all C code is compiled [only] with gcc...
And you do compile with -Wall, right?
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/
.
- Follow-Ups:
- Re: Translating an embedded C algorithm -- OT
- From: Cesar Rabak
- Re: Translating an embedded C algorithm -- OT
- From: Jeffrey Carter
- Re: Translating an embedded C algorithm -- OT
- From: Alex R. Mosteo
- Re: Translating an embedded C algorithm -- OT
- References:
- Translating an embedded C algorithm
- From: Talulah
- RE: Translating an embedded C algorithm
- From: Vo, Anh \(US SSA\)
- Re: Translating an embedded C algorithm
- From: Gautier
- Re: Translating an embedded C algorithm
- From: Jean-Pierre Rosen
- Re: Translating an embedded C algorithm
- From: Ludovic Brenta
- Re: Translating an embedded C algorithm
- From: Cesar Rabak
- Re: Translating an embedded C algorithm
- From: Maciej Sobczak
- Re: Translating an embedded C algorithm -- OT
- From: Cesar Rabak
- Translating an embedded C algorithm
- Prev by Date: Re: Translating an embedded C algorithm -- OT
- Next by Date: Re: Translating an embedded C algorithm
- Previous by thread: Re: Translating an embedded C algorithm -- OT
- Next by thread: Re: Translating an embedded C algorithm -- OT
- Index(es):
Relevant Pages
|