Allow struct constructors with all parameters optional

IchorDev zxinsworld at gmail.com
Thu Aug 29 20:29:22 UTC 2024


On Thursday, 29 August 2024 at 13:57:05 UTC, ryuukk_ wrote:
> Are you seriously telling people to write a library to be able 
> to do what C already provides for decades?

Since when did C99 have struct constructors? You can have a 
factory function in both languages, and they are the preferred 
method for ‘default construction’. However, in C you can’t 
`@disable this()`, so you have to trust the user to get it right 
by calling your factory function instead of just creating an 
uninitialised struct variable.


More information about the dip.ideas mailing list