This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

min/max macros


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..


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]