Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ucsd!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c Subject: Re: down Summary: What is an LValue? What IS an LValue? What is an LVALUE? Message-ID: <114@mole-end.UUCP> Date: 14 Dec 88 08:04:18 GMT References: <45370@yale-celray.yale.UUCP> <2803@hound.UUCP> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 43 > > >... 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