Re: Using functions for MAX and MIN limits thierusability.

From: Tony Robbins (robbinwa@mailbox.orst.edu)
Date: 04/21/01


> George Greer wrote:
> > Consider:
> >
> >         int a = MAX(b++, c);
> I fail to see how that has any relevence, I'm fairly sure it would work

If MAX were the macro:

#define MAX(b, c)    (b > c ? b : c)

Then the above becomes:

int a = (b++ > c ? b++ : c);

Since b++ is evaluated twice, you mangle the numbers you're working with.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST