flag to disable -Wextra check for unsigned compared to 0

John (Eljay) Love-Jensen eljay@adobe.com
Mon Aug 6 10:23:00 GMT 2007


Hi Ethan,

>Our code has a configuration header file with stuff like:
    const unsigned NUM_SENSORS = N;

One strategy is to change those to:
    const int NUM_SENSORS = N;

The rule of thumb being "Use int instead of unsigned int, unless you HAVE to use unsigned int.  And even then, strongly consider using int instead if feasible."

I don't buy into that rule of thumb, which is promoted by several other software engineers who I respect.  But it is something that I'm rolling around and considering.

HTH,
--Eljay



More information about the Gcc-help mailing list