Are void arrays usable ?
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 20 07:41:10 PDT 2014
On Sat, Sep 20, 2014 at 10:09:25AM +0000, badlink via Digitalmars-d-learn wrote:
> Hello,
> I just discovered this strange behavior:
>
> struct A {
> void[10] x; // OK, compiles fine
> }
> class B {
> void[10] x; // Error: void does not have a default initializer
> // ! note, the message come without any line indication !
> }
>
> Does this mean that void arrays are a thing or it is a bug ?
void[] is a wildcard array type that represents a block of memory that
contains an array of some sort. It behaves like ubyte[], except that it
may be GC-scanned for pointers (ubyte[] AFAIK is not scanned because
you're not expected to store pointers in it, but void[] represents *any*
array and thus may contain pointers).
T
--
Not all rumours are as misleading as this one.
More information about the Digitalmars-d-learn
mailing list