Struct default constructor - need some kind of solution for C++ interop
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 7 14:05:32 PDT 2016
The reasons D structs don't have a default constructor:
1. So S.init is a valid initializer
2. So all instances of S can be guaranteed to contain a valid instance
3. So default initialization is guaranteed to succeed
4. So any struct constructor starts with a valid state
5. In my not-so-humble opinion, construction should never fail and all
constructors should be nothrow, but I understand that is a minority viewpoint
Assumptions 1..4 are pervasive in D and the logic of the compiler.
More information about the Digitalmars-d
mailing list