opStarAssign?

Janice Caron caron800 at googlemail.com
Fri Nov 23 09:29:04 PST 2007


On 11/23/07, 0ffh <frank at frankhirsch.youknow.what.todo.net> wrote:
> Janice Caron wrote:
> > My preference would be to have the compiler rewrite
> >     *p += n;
> >
> > as
> >     p.opDerefAssign(p.opDeref() + n);
>
> Wouldn't "p.opAssign(p.opDeref()+n);" be quite sufficient?

I think that would end up being equivalent to
    p = *p + n;

whereas what we actually want is the equivalent of
    *p = *p + n;

but I could be wrong. Maybe it depends on what we consider opAssign
ought to be doing. In any case, we /do/ have opIndexAssign(), so
opDerefAssign() ought to exist by analogy.



More information about the Digitalmars-d mailing list