[Issue 3378] [tdpl] ++x should be an lvalue
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 22 17:32:50 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3378
--- Comment #4 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-11-22 17:32:49 PST ---
(In reply to comment #3)
> I guess, why? Why does ++x need to be an lvalue?
1. It's a departure from C. If we do make that departure, we need a good
reason, which I don't know of. (Before you reply with that, I do remember you
mentioned that dmc yields an rvalue and no client every filed a bug.)
2. For most user-defined types returning a value is considerably more expensive
than returning a reference and nontrivial to remove for the compiler when
unused (requires context sensitivity). If built-ins return an rvalue and
user-defined return a reference, generic code will be gratuitously incompatible
across such types.
For me reason #2 is the more important.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list