[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Freemint sys/params.h



Hallo Mark,

MD>2, I don't know what MAX does here.

It's very simple. Look on the substitution if you call

   int i = 3;
   int j = 4;
   int k = MAX(i++, j--);

After your macro is evaluated, you get

   int i = 3;
   int j = 4;
   k = (i++ > j-- ? i++ : j--);

with the result of k=3 since j is decremented twice. And after the original
macro you get

   int i = 3;
   int j = 4;
   k = ({int _a = i++; int _b = j++;  \
              _a > _b ? _a : _b; });

with the result of k=4 since j is decremented once. That's the difference:
the "original" macro you found behaves more like a function call.

Gruß

     Martin    [PGP-Key available]
---
Für Mails >16 kByte: martin@melsaesser.de