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
intbecause it is by definition a signed type (§6.2.5/4). Consider themainfunction which must return typeint(§5.1.2.2.1/1), if you change the default signedness somehow, thenmainwill returnunsigned int, and this will cause undefined behaviour, rendering your entire application relatively useless.You can’t create a macro, because if
intexpands tounsigned int, then if you have declaredunsigned intsomewhere, you will end up withunsigned unsigned int, which is not a valid type.