Re: Using functions for MAX and MIN limitsthierusability.

From: Peter Ajamian (
Date: 04/23/01

George Greer wrote:
> Perhaps you want:
> `-Wconversion'

Actually my concern was more the opposite, that such warnings might be
included in the -Wall set and hence cause the compiler to complain a lot
if the arg and return types of the MIN and MAX functions were changed to
long in order to allow greater use with 16 bit compilers.

> You'll need to ignore a lot of system header stupidity though.

Yeah, no kidding, been down that road (ever try compiling some of the
packages that you normally get in binary for a Linux distribution?  You
get all kinds of warnings on some of them).

> >Take that one step further and maybe even test for implementations that
> >have a long long type (it won't be very long until all have long long
> >types since C99 supports long long anyways).
> If I use C99, I'm using types of the form 'int32', 'uint64', and the like,
> not 'long long' and such. (Not the official names, just example.)

The only thing that I might consider advantagious to using the admittedly
more klunky long long and the like might be for backwards compatibility
(since many pre-C99 compilers support those types, ie gcc).  Of course
I'm not too familiar with _all_ the types that the various compilers
support so this might be a mute point.  Of course I've taken the position
before and still do that any C99-specific features should be very
carefully considered before being taken advantage of as I personally
don't feel that C99 support is widespread enough to be taken for granted,
of course I'll happily speculate on the usefullness of it, etc. (mutters
because it's 4AM and he can't come up with the right words to express
what he's thinking).

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST