public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* min/max macros
@ 1997-12-11  9:17 Bill Ahlbrandt
  1997-12-11 13:03 ` dave madden
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Bill Ahlbrandt @ 1997-12-11  9:17 UTC (permalink / raw)
  To: 'egcs@cygnus.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..

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: min/max macros
@ 1997-12-11 19:02 Mike Stump
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Stump @ 1997-12-11 19:02 UTC (permalink / raw)
  To: bahlbr, egcs

> Date: Thu, 11 Dec 1997 12:03:45 -0800
> From: dave madden <dhm@paradigm.webvision.com>

> min/max macros are not inherently bad, as long as you understand
> that they evaluate their arguments more than once.

Spraying a crowd with bullets from an automatic rife isn't bad, it's
only bad if people get hit...


Bad.  Period.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1997-12-12 10:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-11  9:17 min/max macros Bill Ahlbrandt
1997-12-11 13:03 ` dave madden
1997-12-11 13:03 ` Michael A. Benzinger
1997-12-11 13:43 ` [EGCS] " Marc Lehmann
1997-12-11 13:43 ` Gerald Pfeifer
1997-12-11 17:57   ` [EGCS] " Marc Lehmann
1997-12-11 19:51     ` Joe Buck
1997-12-12 10:18       ` Marc Lehmann
1997-12-12  7:51 ` Paul Koning
1997-12-11 19:02 Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).