New Features: ++(expr)

Paul Sutcliffe Jr. paul at devon.UUCP
Sun Feb 14 03:47:19 AEST 1988


In article <1102 at bc-cis.UUCP> john at bc-cis.UUCP (John L. Wynstra) writes:
> In article <386 at osupyr.UUCP> ddc at osupyr.UUCP (Don Comeau) writes:
> > Since everyone else is suggesting their addition 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?

> 	Yes, can you say redundant?  You said it yourself, the thing is
> `(expression)+1', why have another name for the same thing?  And as to
> the traditional use, why would ++ or -- ever apply to anything but
> lvalues (remembering that *(pointer-expression) is one)?
> 	You guys on the ANSI committee, leave my C alone!  (I like it K&&R
> thank'ee, black, no sugar, please.)

John, your coffee cup (as well as your statement) are full of holes.
Sure, ++expression is redundant.  So is ++lvalue.  If you dispise the
redundancy, why have ++ and -- at all, since I can easily use

	lvalue = lvalue + 1

or
	lvalue += 1

Of course, for lvaluse, ++ and -- are K&R 'C', so you must have them,
yet you say Don's suggestion is bad.  Think about it.

- paul

-- 
Paul Sutcliffe, Jr.				       +----------------------+
						       |  THINK ...           |
UUCP (smart):  paul at devon.UUCP			       |            or THWIM  |
UUCP (dumb):   ...rutgers!bpa!vu-vlsi!devon!paul       +----------------------+



More information about the Comp.lang.c mailing list