min/max macros
Bill Ahlbrandt
bahlbr@icdata.com
Thu Dec 11 09:17:00 GMT 1997
I have noticed that these macros are not always available and not always in the same place.
Specifically, with egcs, they seem to be in curses.h
I "coded" my own and used them as follows:
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
After discovering that max in particular was not yielding the desired results, I coded these macros as functions. All of my problems went away.
Is it generally a bad plan to use macros like this? Are there any known problems with egcs involving macros such as these?
Thanks in advance..
More information about the Gcc
mailing list