opStar

Bill Baxter dnewsgroup at billbaxter.com
Mon Nov 12 10:22:05 PST 2007


Janice Caron wrote:
> On 11/12/07, Walter Bright <newshound1 at digitalmars.com> wrote:
> 
> If the latter, then p is behaving like a pointer-to-a-pointer, not a
> pointer, and now you'd have to (**p), not (*p), to reach an actual
> VeryLargeStruct, and you'd have to write (**p).m to access the members
> thereof.

Well, actually (*p).m would work too even if (*p) returns a pointer. 
But yeh, if the VeryLargeStruct had an opAdd you wanted to invoke then 
you'd need  (**p)+5

But anyway Walter has said that returnable references are coming at some 
point.  So maybe the answer is that you use the pointer kludge until 
that happens.  The problem is not unique to opStar.  opIndex also has 
that issue.  p[0].m is presumably doing the same thing opStar would do 
with VeryLargeStruct.

--bb



More information about the Digitalmars-d mailing list