Guess the result of the following code.


[Code]

#include <iostream>
#include <limits.h>

using namespace std;

int main()
{
	{
		char c1 = CHAR_MAX;
		char c2 = (c1 + 1) / 2;
		cout << c2 << endl;
	}
	{
		short s1 = SHRT_MAX;
		short s2 = (s1 + 1) / 2;
		cout << s2 << endl;
	}
	{
		int i1 = INT_MAX;
		int i2 = (i1 + 1) / 2;
		cout << i2 << endl;
	}
}



[Result]

@           // not overflow (64)
16384       // not overflow
-1073741824 // overflow



[Conclusion]

Even if variable type is 8 bit(char) or 16 bit(short), compiler can use the higher level register(e.g. 32 bit EAX).