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]

Re: [EGCS] min/max macros


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


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