constant signed/unsigned comparison warning

Peter Seebach seebs@solutions.solon.com
Wed Sep 24 15:13:00 GMT 1997


>4) Make sizeof() be standard-as-The-Book-says unsigned. Make __sizeof__
>behave like I proposed. People who want the incompatible thing can just
>#define sizeof(x) __sizeof__(x)
>and be sure that other, non-GCC, compilers will barf (because they don't
>know zilch about any __sizeof__). Everybody wins. Hopefully.

Except that there's no *guarantee* that the other compilers will barf;
they are quite welcome to have a '__sizeof__' which returns what they
expect.

Anyway, if you want that, you can do it now;
	#define sizeof(x) ((int) sizeof(x))
should do what you want sizeof() to do...  (and is as safe as anything
like that can be said to be.)

>5) We continue this somewhat-heated exchange until everybody is fed up
>with it.

That's the traditional solution.

-s



More information about the Gcc mailing list