"recvfrom" <re******@gmail.com> wrote in news:1142816650.901465.228160
@z34g2000cwc.googlegroups.com:
I have a need to define a macro to be the larger (integer comparison)
of two other macros, already defined in system header files. Is this
possible??
I would have tried the obvious before asking:
#include <stdio.h>
#define VAL1 10
#define VAL2 20
#if VAL1 > VAL2
#define VAL_MAX VAL1
#else
#define VAL_MAX VAL2
#endif
int main(void) {
printf("%d\n", VAL_MAX);
return 0;
}
/* EOF */
D:\Home\asu1\UseNet\clc> gcc -Wall -W t.c -o t.exe -ansi -pedantic
D:\Home\asu1\UseNet\clc> t
20
I am assuming this is standards compliant, and hope someone will correct
me if it isn't.
Sinan
--
A. Sinan Unur <1u**@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html