[Issue 2657] New: Remove opPostInc, opPostDec
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 13 07:48:22 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2657
Summary: Remove opPostInc, opPostDec
Product: D
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: clugdbug at yahoo.com.au
The postincrement and postdecrement operators should be redefined in terms of
the preincrement operator.
Define x++, x-- as being identical to ++x, --x,
except that it should be illegal to use the return value of x++.
In effect, this means that internally, x++ will become cast(void)(x+=1);
Currently, overloaded operators for opPostInc, opPostDec() always involve a
potentially expensive creation of a copy of the object, which is almost never
used.
This useless and painful feature inherited from C++ can safely be dropped.
It's likely that there is no extant D code which uses this feature.
--
More information about the Digitalmars-d-bugs
mailing list