C puzzle

Hubert Yamada yamada at stego.ifa.hawaii.edu
Tue Jun 25 14:08:31 AEST 1991


[This quote been edited to shorten it]
In article <1173 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>In article <13544 at uhccux.uhcc.Hawaii.Edu> yamada at stego.ifa.hawaii.edu (Hubert Yamada) writes:
>>Actually, I don't know of any C compiler that _won't_ tell you about
>>this error, if you set the warning level reasonably high.  With UNIX
>>cc, setting the warning level high enough == use lint.
>
>Using lint only works if you are in the happy situation that your
>compiler (together with its header-files) is not yet so much ANSI-fied
>that your lint becomes unusable. (I'm sometimes forced to use such a beast;
>it's halfway down the road to ANSI-C. I like to profit from function
>prototypes, but sadly enough the lint on this system is the "old" one,
>which doesn't know anything of all that.)

This is _so_ true.  Fortunately, the ansi compilers that I've dealt
with had better local error checking than cc.  But I haven't found any
compiler that does global error detection as well as lint does.  I've
taken the approach of writing code that compiles correctly under ansi C
compilers and under traditional C compilers.  In order to do this I've
been forced to use some macros that modify declarations and prototypes
depending on the type of compiler is.  This lets me have the advantage
of both.  But the macros are ugly and clumsy, and the resultant code is
_very_ugly_.
-- 
****************************************************************************
Hubert Yamada
Internet: yamada at galileo.ifa.hawaii.edu (or yamada at uhunix.uhcc.hawaii.edu)
Bitnet: yamada at uhunix.bitnet



More information about the Comp.lang.c mailing list