Is #define THING -10 completely safe?

Doug Gwyn gwyn at smoke.brl.mil
Mon Jan 28 16:08:07 AEST 1991


In article <33 at christmas.UUCP> rtm at island.COM (Richard Minner) writes:
>Something I've been curious about, should the above be
>#define INT_MIN   (-2147483648)

Yes.

>The precedence rules seem to imply that ()'s aren't needed
>with a negative integer constant.

There are contexts that could cause trouble, e.g. "x-INT_MIN"
or "x=INT_MIN".  While the C standard requires that these work
as expected, many older C implementations will misinterpret
these.



More information about the Comp.lang.c mailing list