How can I (if I can) set the default int variable (in a specific program) to be unsigned int?
I mean that if int
is written in the program, the compiler treats it like unsigned int
.
My compiler is gcc 4.6.2
EDIT: I am not authorized to touch the code.
You can't change the default signedness of int
because it is by definition a signed type (§6.2.5/4). Consider the main
function which must return type int
(§5.1.2.2.1/1), if you change the default signedness somehow, then main
will return unsigned int
, and this will cause undefined behaviour, rendering your entire application relatively useless.
You can't create a macro, because if int
expands to unsigned int
, then if you have declared unsigned int
somewhere, you will end up with unsigned unsigned int
, which is not a valid type.