Small suggestion for default constructors

Mike Parker aldacron at gmail.com
Tue Jan 17 03:02:46 UTC 2023


On Tuesday, 17 January 2023 at 02:45:30 UTC, TheZipCreator wrote:

> For structs, it automatically generates a constructor, and it'd

There's a distinction. The default initializer for a struct is 
the `.init` value of each member. `T()` is not a default 
constructor, but a struct literal that's equivalent to `T.init`.

The default initializer for classes is always null and we don't 
have class literals.

I'm not arguing against your suggestion here. Just wanted to 
point out the distinction.


More information about the Digitalmars-d mailing list