问题
I am reading some tutorials on embedded programming and one of them says int and signed int are different but does not explain how or why.
I understand why unsigned int and int are different but int and signed int being different is a new one for me.
回答1:
It is for historical reasons only. Today whenever you declare int you get a signed int. The only point where you might see a difference even with today's compilers is with char versus signed char which are different by specification (and notable when assigning a literal string) but not with int.
回答2:
As far as I know the difference exists only for char data type. Where char a; can be signed char a; or unsigned char a; depending on compiler options. As this article says. (--signed_chars)
For int data types, there is no difference between int and signed int.
来源:https://stackoverflow.com/questions/12952553/difference-between-int-and-signed-int-declaration