Structs, the most buggiest language feature?

Benjamin Thaut code at benjamin-thaut.de
Wed Jul 11 00:52:40 PDT 2012


In the past few months working on my little hobby project I came across 
many bugs, and almost all of them are connected to structs in one or the 
other way. So I made a list of all the bugs that affected me and are 
connected to structs:

Destruction of uninitialized temporary struct with assert  - 
http://d.puremagic.com/issues/show_bug.cgi?id=8360

@disable this propagates through reference - 
http://d.puremagic.com/issues/show_bug.cgi?id=8296

Struct member destructor can not be called from shared struct instance 
- http://d.puremagic.com/issues/show_bug.cgi?id=8295

__postblit and __dtor on structs only work if they are explicitly 
defined (no ticket yet)

Struct destructor is not called on out parameter - 
http://d.puremagic.com/issues/show_bug.cgi?id=6186

_d_arraycopy should take TypeInfo as final argument instead of simply 
element size - http://d.puremagic.com/issues/show_bug.cgi?id=6182

Copy constructor and templated opAssign cannot coexist - 
http://d.puremagic.com/issues/show_bug.cgi?id=4424

Calling struct.init causes a memory allocation. - 
http://d.puremagic.com/issues/show_bug.cgi?id=7271 (the only one fixed 
so far)

Structs with disabled default constructors can be constructed without 
calling a constructor.  - http://d.puremagic.com/issues/show_bug.cgi?id=7021

And those are only the bugs that affected me, there are countless more 
in the bug tracker.

I wanted to suggest that one developement cycle is spend on fixing as 
many of the struct connected bugs as possible. Structs are a really 
important language feature that also often is supposed to be used as a 
replacement for deperecated features (scope, typedef, ...)

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list