Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!news.arc.nasa.gov!uhccux!stego!yamada From: yamada@stego.ifa.hawaii.edu (Hubert Yamada) Newsgroups: comp.lang.c Subject: Re: C puzzle Message-ID: <13625@uhccux.uhcc.Hawaii.Edu> Date: 25 Jun 91 04:08:31 GMT References: <1991Jun20.010011.18425@menudo.uh.edu> <13544@uhccux.uhcc.Hawaii.Edu> <1173@mwtech.UUCP> Sender: news@uhccux.uhcc.Hawaii.Edu Organization: Institute for Astronomy, Hawaii Lines: 28 [This quote been edited to shorten it] In article <1173@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: >In article <13544@uhccux.uhcc.Hawaii.Edu> yamada@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@galileo.ifa.hawaii.edu (or yamada@uhunix.uhcc.hawaii.edu) Bitnet: yamada@uhunix.bitnet