This is the mail archive of the
mailing list for the GCC project.
Re: [EGCS] min/max macros
- To: egcs at cygnus dot com
- Subject: Re: [EGCS] min/max macros
- From: Marc Lehmann <pcg at goof dot com>
- Date: Thu, 11 Dec 1997 20:29:12 +0100
- References: <01BD0625.FDFCC640@bill.icdata.com>
- Reply-To: egcs at cygnus dot com
On Thu, Dec 11, 1997 at 11:14:41AM -0600, Bill Ahlbrandt wrote:
> I have noticed that these macros are not always available and not always in the same place.
there is no standard for them, and they are not part of egcs.
> Specifically, with egcs, they seem to be in curses.h
curses.h has nothing to do with egcs.
> 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))
these are fine, as long as you are aware of them being macros...
there's probably no better way to do this in plain C, using
gcc extensions, you can code macros without side effects.
> Is it generally a bad plan to use macros like this? Are there any known
> problems with egcs involving macros such as these?
No.. It would be much better if you could provide us with more information
regarding the problems you have.
----==-- _ |
---==---(_)__ __ ____ __ Marc Lehmann +--
--==---/ / _ \/ // /\ \/ / email@example.com |e|
-=====/_/_//_/\_,_/ /_/\_\ --+
The choice of a GNU generation |