==, is

Jonathan M Davis jmdavisProg at gmx.com
Mon Nov 15 12:51:40 PST 2010


On Monday 15 November 2010 12:40:43 Ellery Newcomer wrote:
> a while ago, I assumed that
> 
> e1 += e2
> 
> gets rewritten as
> 
> e1 = e1 + e2
> 
> Yeah. It doesn't. It doesn't even behave the same wrt erroneously typed
> arguments

Well, that would potentially be two different set of operator overloads (+= vs = 
and/or +), so they definitely can't act the same, though I can see why you'd 
think so at first glance. None of the operators that you specificy have that 
problem. Still, it pays to be careful. It can be easy to make erroneous 
assumptions.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list