It seems sizeof is not a real function?
for example, if you write like this:
int i=0;
printf("%d
", sizeof(++i));
printf("%d
", i);
You may get output like:
4
0
And when you dig into the assemble code, you'll find sth like this:
movl $4, %esi
leaq LC0(%rip), %rdi
xorl %eax, %eax
call _printf
So, the compiler put directly the constant "4" as parameters of printf add call it. Then what does sizeof do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…