🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #58

Re: on "use", and the lvalue-ness of string literals

#58
From: Clive Feather
Date: Tue, 03 Nov 1992 07:47
25 lines
1332 bytes
In article <1992Nov2.162310.10094@ichips.intel.com> bhoughto@sedona.intel.com (Blair P. Houghton) writes:
> `if ( foo ) /* empty */;' does not
> have any side effects, but definitely does use the value
> of `foo'.

| An actual implementation need not evaluate part of an expression if it
| can deduce that its value is not used and that no needed side effects
| are produced (including any caused by calling a function or accessing a
| volatile object).
[ISO C 5.1.2.3]

> "A string literal is a primary expression.
>  It is an lvalue..."
>
> It's an LVALUE.  This means that,
>	"foo" = "bar";
> is legal.  Right?

Wrong. It's not a *modifiable* lvalue.

-- 
Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
clive@x.co.uk          | Vision Park         | it will get its revenge.
Phone: +44 223 236 555 | Cambridge   CB4 4RZ |   - Henry Spencer
Fax:   +44 223 236 550 | United Kingdom      |
Technical Details
Message-ID: <1992Nov03.074747.16658@x.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!agate!doc.ic.ac.uk!uknet!acorn!ixi!clive
References: <1992Nov2.162310.10094@ichips.intel.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!agate!doc.ic.ac.uk!uknet!acorn!ixi!clive
From: clive@x.co.uk (Clive Feather)
Newsgroups: comp.std.c
Subject: Re: on "use", and the lvalue-ness of string literals
Message-ID: <1992Nov03.074747.16658@x.co.uk>
Date: 3 Nov 92 07:47:47 GMT
References: <1992Nov2.162310.10094@ichips.intel.com>
Organization: IXI Limited, Cambridge, UK
Lines: 25