[comp.lang.c++] comment on ++/

baud@gt-eedsp.UUCP (Kurt Baudendistel) (10/05/88)

C++ is defined to allow both pre- and post- increment and decrement
operators to be used, but they both act like the corresponding pre-
operator. this is a source of confusion, which is dealt with in a
variety of ways:

  1. rely on the user to know that the pre- operators actually
     perform post- operations for user defined types. this is
     bound to cause problems.

  2. cause the operators to return the type void (this is the g++
     library standard technique). this removes the valid use of
     pre- return values.

wouldn't it be better/simpler to simply disallow use of the pre-
form of these operators by making these operators (in post- form)
non-overloadable? this is the effect of the conventions as discussed 
above anyway. or better yet, could c++ preserve the pre- and post- 
operators and have them work for user defined types just like they do 
for built-in types?

comments?
kurt
-- 
Kurt Baudendistel [GRA McClellan]
Georgia Tech, School of Electrical Engineering, Atlanta, GA  30332
USENET: ...!{allegra,hplabs,ihnp4,ulysses}!gatech!gt-eedsp!baud
INTERNET: gt-eedsp!baud@gatech.edu