Disallowing S() when struct S has a constructor

Matheus Catarino matheus-catarino at hotmail.com
Sun Sep 8 00:00:49 UTC 2024


On Thursday, 5 September 2024 at 17:46:18 UTC, Quirin Schroll 
wrote:
> C++ has had default constructors forever. It’s one of the few 
> decisions where I’m convinced that C++ got it right and D 
> isn’t. “Variable declarations must be cheap” is a dogma that 
> I’d expect in a language like C or Zig, not in a language like 
> D, where frequently, safety wins over performance. The fact 
> that I can declare a variable in D and it might not be safe to 
> use is a problem.
>

Apparently Zig is also about to adopt `.init`/`.default`/`.empty` 
during variable declaration. Even if there is no ctor/dtor (RAII).

https://ziggit.dev/t/prefered-method-to-initialize-generalpurposeallocator/5875/13


More information about the Digitalmars-d mailing list