Working on a library: request for code review
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 19 05:06:56 PDT 2014
On Wednesday, 18 June 2014 at 14:05:12 UTC, Rene Zwanenburg wrote:
> On Tuesday, 17 June 2014 at 13:07:33 UTC, Marc Schütz wrote:
>> On Monday, 16 June 2014 at 23:04:33 UTC, Rene Zwanenburg wrote:
>>> This one depends on taste, but these helpers can be
>>> eliminated by changing the Header definition a little. It's
>>> the same union / anonymous struct trick from the previous
>>> post, only this time with bitfields:
>>>
>>> http://dpaste.dzfl.pl/13258b0ce0c4
>>
>> If you define nested structs/unions, it's better to make them
>> static whenever possible, because non-static nested structs
>> have an additional hidden field for the context.
>
> Good call. In this case it doesn't add the hidden field, but
> for the sake of consistency I agree it's better to add static.
Interesting, I thought it's there for all nested structs. But I
see it's only added if the struct has a method, but then it's
always there, no matter whether the methods actually accesses the
outer context. Probably for consistency reasons...
More information about the Digitalmars-d-learn
mailing list