This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
min/max macros
- To: "'egcs at cygnus dot com'" <egcs at cygnus dot com>
- Subject: min/max macros
- From: Bill Ahlbrandt <bahlbr at icdata dot com>
- Date: Thu, 11 Dec 1997 11:14:41 -0600
- Reply-To: egcs at cygnus dot com
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..