should a delegate context ever be a non pointer?
BCS
ao at pathlink.com
Fri May 4 23:14:21 PDT 2007
Reply to Walter,
> BCS wrote:
>
>> static delegate(MyObject) Build(uint i, uint k)
>> {
>> Ctx c;
>> c.h = k;
>> c.l = i;
>> return &c.FillS;
>> }
> Looks like you're returning the address of a stack variable, which
> will cause erratic behavior.
>
The distinction that the proposed syntax would use is that the function that
is used has, as it's first argument, a structure as opposed to a pointer
to a structure. This would result in the structure being loaded (by value)
into the context of the delegate and alls well and good. Of course the exact
syntax is not important, What I'm hoping for is some non-hack way to use
the context of a delegate for something other than a pointer to a struct,
object or stack frame.
More information about the Digitalmars-d
mailing list