Strange enum type conversion

John (Eljay) Love-Jensen eljay@adobe.com
Thu Dec 3 17:11:00 GMT 2009


Hi Richard,

> Forget that.  I'm talking nonsense.

No harm, no foul.  :-)

> An int is signed only if it's smaller than INT_MAX in magnitude.

And as long as it doesn't exceed UINT_MAX.  Normal promotion rules apply.

> Otherwise it's unsigned (hence #defining INT_MIN as (-INT_MAX - 1)

On a 2's complement machine.

On a 1's complement, #define INT_MIN (-INT_MAX)

Sincerely,
--Eljay



More information about the Gcc-help mailing list