Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)bebanned?



Skybuck Flying wrote:
By the way, there is one situation in Delphi where calling SizeOf
on a variable is the only thing you can do -- it's impossible to
call SizeOf on that variable's type.
And what would that be ?
I'll give you a hint. It has to do with a certain kind of array.

Well, I tried all kinds of combinations.

So far I can call SizeOf on those combinations just fine.

Then you haven't tried them all. Here's another hint. This kind of array is only usable when it appears in a parameter declaration.

--
Rob
.



Relevant Pages

  • Re: A couple of things from H&S
    ... expression of array type decays to a pointer to the array's first ... element *unless* it's in one of three contexts: the operand of sizeof, ... is quite obvious, p is the pointer. ...
    (comp.lang.c)
  • Re: Null terminated strings: bad or good?
    ... specified type, it must not be possible to use callocto allocate such ... allocate such an array, that still doesn't make it possible for ... For any object that you can actually define in your program, with either static or automatic storage duration, "sizeof object" is supposed to give the size of that object; the standard provide no exceptions to this requirement. ...
    (comp.lang.c)
  • Re: C Strings
    ... sizeof ... More generally, given any array object, we can find a pointer to ... works quite as well for C99 as it did for C89, ...
    (comp.lang.c)
  • Re: Question about sizeof
    ... Mark double $$ ... This is true in any situation, not only with sizeof ... Cant you keep original values in the array instead of the variable names? ... -Each type of discography is associated with an array that contains ...
    (comp.lang.php)
  • Wording glitch: sizeof array vs. sizeof (array)
    ... A parenthesized expression is a primary expression. ... Except when it is the operand of the sizeof operator or the unary ... & operator, or is a string literal used to initialize an array, an ...
    (comp.std.c)