std.format and uninitialized elements in CTFE

Steven Schveighoffer schveiguy at gmail.com
Thu Dec 5 20:47:02 UTC 2019


On 12/5/19 2:56 PM, kinke wrote:
> On Thursday, 5 December 2019 at 18:37:03 UTC, berni44 wrote:
>> Should std.format check if the members of a struct are not initialized 
>> and do what in that case?
> 
> It shouldn't, and there's no such thing as uninitialized struct/class 
> *members*, there are only uninitialized whole struct instances. There 
> are surely bugzillas wrt.
> 
> struct S { int bla = void; }
> 
> having no effect (correct way: `S s = void`). IMO, void member 
> initializers should be invalid to make that clear.

Well, as long as all members are void initialized, then it should have 
an effect right? I know that the compiler blits the whole struct at 
once, but if it's all void initialized, it doesn't have to.

-Steve


More information about the Digitalmars-d mailing list