void size
Deewiant
deewiant.doesnotlike.spam at gmail.com
Wed May 23 06:27:24 PDT 2007
orgoton wrote:
> The program
>
> import std.stdio;
> import std.string;
>
> void main ()
> {
> writefln("Sizeof(void)="~toString(void.sizeof));
> }
>
> compiles and outputs "sizeof(void)=1". Is this supposed to happen? I mean, in C, it is an error to request sizeof(void) (compiler fails).
Yes, it is supposed to happen. I can't find a Walter quote or documentation for
it, but IIRC void.sizeof is defined as 1 in order for void arrays to work properly.
--
Remove ".doesnotlike.spam" from the mail address.
More information about the Digitalmars-d-learn
mailing list