down
Mark A Terribile
mat at mole-end.UUCP
Wed Dec 14 18:04:18 AEST 1988
> > >... I think the following SHOULD work, but will not even compile:
> > >... chcnt++ += (c == '\n');
> >
> > You can't assign to a ++ expression.
> Of course you can! For example, a simple string copy function:
> ... while (*to++ = *from++) ...
Harrumph!
*to++ = ...
associates as
( *(to++) ) = ...
If I may quote K&R (Appendix A, section 7.2):
The unary * operator means _indirection_: the expression
must be a pointer, and the result is an lvalue referring to
^^^^^^
the object to which the expression points.
That's altogether different from
( to++ ) = ...
Again quoting K&R (same section):
When postfix ++ is applied to an lvalue, the result is the
value of the object referred to by the lvalue. After the
result is noted, the object is incremented ...
Note carefully: ``the result is the value of the object referred to''
^^^^^
That's value (or rvalue), NOT lvalue.
Please excuse my dogmatic voice, but this is getting silly.
(This man's opinions are his own.)
>From mole-end Mark Terribile
--
(This man's opinions are his own.)
>From mole-end Mark Terribile
More information about the Comp.lang.c
mailing list