Just noticed this on OSX and I found it curious as I expected long to be bigger than int.
Is there any good reason for making them the same size?
Just noticed this on OSX and I found it curious as I expected long
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a result of the loose nature of size definitions in the C and C++ language specifications. I believe C has specific minimum sizes, but the only rule in C++ is this:
Moreover,
sizeof(int)andsizeof(long)are not the same size on all platforms. Every 64-bit platform I’ve worked with has hadlongfit the natural word size, so 32 bits on a 32-bit architecture, and 64 bits on a 64-bit architecture.