New Features: ++(expr)

0732 al at gtx.com
Fri Feb 12 05:19:17 AEST 1988


In article <386 at osupyr.UUCP> ddc at osupyr.UUCP (Don Comeau) writes:
>
>Since everyone else is suggesting their addtion to C, here is one I
>think would be useful.  Why are ++ and -- still limited to lvalues?  I
>think ++expresion should be an expression which has the value
>expression+1.
>
>Are there any good reason why this hasn't been done?
>

A better question is "Is there any good reason why this should be done?".
In what situation would ++(a+b) provide any advantage over a+b+1 ?

Generalization may be good if it provides some simplification, but in
this case, neither the compiler writer nor the programmer benefit.

I can't think of any other case in which the semantics of an expression
depend on whether or not the arguments are lvalues.

>
>Flames welcome!  Maybe I'd learn something.
>

Sorry if I wasn't abusive enough.

    ----------------------------------------------------------------------
   | Alan Filipski, GTX Corp, 2501 W. Dunlap, Phoenix, Arizona 85021, USA |
   | {ihnp4,cbosgd,decvax,hplabs,amdahl}!sun!sunburn!gtx!al (602)870-1696 |
    ----------------------------------------------------------------------



More information about the Comp.lang.c mailing list