Signals and Slots
Walter Bright
newshound at digitalmars.com
Thu Nov 2 11:23:43 PST 2006
Sean Kelly wrote:
> Walter Bright wrote:
>> http://www.digitalmars.com/d/std_signals.html
>>
>> And that, hopefully, is that.
>
> Nice work! In skimming the code, one thing jumped out at me:
>
> signals.d:171: len += len + 4;
>
> I think this should be: len += 4;
>
> Or actually: len += (void*).sizeof;
No, that is as intended. It's using a power of 2 allocation method.
Also, the sizeof thing is taken care of by the call to calloc/realloc.
> To be 64-bit safe. Finally, is there any reason to use _d_toObject in
> this code instead of cast(Object)? I'd think they would do the same thing?
Not exactly. cast(Object)p won't do the pointer adjustment if the type
of p is a void*. To convert an interface to its underlying Object, the
cast implementation needs to know what the interface type is.
More information about the Digitalmars-d
mailing list