Struct default constructor - need some kind of solution for C++ interop

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 8 14:30:21 PDT 2016


On Thursday, 8 September 2016 at 11:18:12 UTC, Walter Bright 
wrote:
>
>> http://www.agner.org/optimize/microarchitecture.pdf section 
>> 3.13 has a bit more
>> info on the branch predictor. Desktop Intel CPUs tend to hide 
>> performance
>> problems like this thanks to their far-higher-quality branch 
>> predictors. Both
>> chips gain benefits from sorting to how you expect the branch 
>> predictor to work,
>> but there's a lot of code in a game codebase that isn't that 
>> low level.
>
> There's another way. Just don't worry about it being null, if 
> you're going to ensure it is initialized regardless. It'll seg 
> fault if it is dereferenced but not initialized.

Doesn't this seem to contradict the ".init is always a valid 
state" ideal?



More information about the Digitalmars-d mailing list