vipvipvipvip.ru@gmail.com writes:
> On Oct 17, 6:07 pm, David Resnick <lndresn...@gmail.com> wrote:
>> Is the second legitimate? It compiles without complaint, but looks
>> dodgy.
> Yes it is.
> Consider the following:
> int *p;
> printf("sizeof(*p) == sizeof(int) == %zu\n", sizeof *p);
> This would've been invalid code if what p pointed to was really
> accessed.
Yes, it would have. Fortunately, the argument to sizeof is never
evaluated unless it's a VLA.
--
Keith Thompson (The_Other_Keith)
kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"