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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…