What is the return type of sizeof
operator? cppreference.com & msdn says sizeof
returns size_t
. Does it really return a size_t
?
I'm using VS2010 Professional, and targeting for x64.
int main()
{
int size = sizeof(int); // No warning
int length = strlen("Expo"); //warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
return 0;
}
I have this question because first line is not issuing any warning, whereas the second does. Even if I change it to char size, I don't get any warnings.