Disallowing S() when struct S has a constructor
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Fri Aug 30 04:00:22 UTC 2024
On Thursday, August 29, 2024 10:44:46 AM MDT Nick Treleaven via Digitalmars-d
wrote:
> Should we make S() for any struct an error in the next edition?
I know that some folks use S() instead of S.init, because S.init still works
when default initialization is disabled, but S() doesn't. So, if you use S()
in a context where you would typically use S.init, then you avoid
accidentally using the init value of a struct that has disabled default
initialization.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list