| Keith Thompson 2006-02-26, 3:55 am |
| Michael Mair <Michael.Mair@invalid.invalid> writes:
[...]
> In C89, sizeof is a compile time operator; its operand is not
> really evaluated, only the type of the operand.
> So, it really does not play a role whether you have
> iarray = NULL;
> iarray = malloc(nints * sizeof *iarray);
> or whatever.
> In C99, variable length arrays require sizeof to evaluate
> the type at run time, but the "operand is not evaluated"
> part remains true.
Actually, C99 says
If the type of the operand is a variable length array type, the
operand is evaluated; otherwise, the operand is not evaluated and
the result is an integer constant.
But I can't think of a case where "evaluating" a variable length array
has any effect other than determining its size (quite possibly I'm
missing something).
But of course this isn't relevant to the original question, which
doesn't involve 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.
|