digitalmars.D.learn - Are void arrays usable ?
- badlink (11/11) Sep 20 2014 Hello,
- bearophile (14/15) Sep 20 2014 You can compile that with:
- bearophile (3/4) Sep 20 2014 https://issues.dlang.org/show_bug.cgi?id=13505
- H. S. Teoh via Digitalmars-d-learn (9/21) Sep 20 2014 void[] is a wildcard array type that represents a block of memory that
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 ?
 Sep 20 2014
badlink:Does this mean that void arrays are a thing or it is a bug ?You can compile that with: class Foo { void[10] x = void; } But this code shows a dmd bug (lack of line number): class Foo { void[10] x; } void main() {} Error: void does not have a default initializer Take a look in bugzilla, if it's not already present file it. Bye, bearophile
 Sep 20 2014
Take a look in bugzilla, if it's not already present file it.https://issues.dlang.org/show_bug.cgi?id=13505 Bye, bearophile
 Sep 20 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.
 Sep 20 2014








 
  
  
 
 "bearophile" <bearophileHUGS lycos.com>
 "bearophile" <bearophileHUGS lycos.com> 