From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Lehmann To: egcs@cygnus.com Subject: Re: [EGCS] min/max macros Date: Thu, 11 Dec 1997 13:43:00 -0000 Message-id: <19971211202912.44533@cerebro.laendle> References: <01BD0625.FDFCC640@bill.icdata.com> X-SW-Source: 1997-12/msg00676.html 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 No.. > 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 +-- --==---/ / _ \/ // /\ \/ / pcg@goof.com |e| -=====/_/_//_/\_,_/ /_/\_\ --+ The choice of a GNU generation | |