🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #70

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

#70
From: John F. Woods
Date: Wed, 04 Nov 1992 19:17
33 lines
2017 bytes
bhoughto@sedona.intel.com (Blair P. Houghton) writes:
>I'm trying to develop a good definition, and it's come
>down to a few expression forms.  The important
>thing to remember is that it's the value, not the
>identifier or the location, that is being "used."
>	if ( foo ) ...;		/* uses `foo' */
>	foo;			/* does not use `foo' */

I'm not even sure that I know what you want to mean by "use".  The "if"
statement there accesses the object named by the identifier "foo" (assuming 
that "foo" is declared as designating an object); the expression statement
below it accesses the object named by the identifier "foo" and then discards
the value of that object.  One would think that if "foo" were declared as
"volatile", the object designated by "foo" here *must* be accessed in a
running program.  The definitive answer, if one can call it that, is to be
found in section 3.5.3 "Type Qualifiers" of the ANSI standard:  "What
constitutes an access to an object that has volatile-qualified type is
implementation-defined."  Perhaps, then, an implementation has the license
to define that

	foo;

does not access the object referred to by foo, and/or that

	foo = x;

does, though in the first case I *think* that's stretching the license too far.
Remember that a strictly conforming program cannot use "volatile"; it is not
a guarantee of portability, it is a "portable" way to beg for mercy :-).

Others have hammered the "non-modifiable lvalue" answer to death; I'll just
point out that it would have been glaringly obvious had you read the section
entitled "Lvalues and Function Designators"...
Technical Details
Message-ID: <18106@ksr.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!world!ksr!jfw
References: <1992Nov2.162310.10094@ichips.intel.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!world!ksr!jfw
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.std.c
Subject: Re: on "use", and the lvalue-ness of string literals
Message-ID: <18106@ksr.com>
Date: 4 Nov 92 14:17:45 EST
References: <1992Nov2.162310.10094@ichips.intel.com>
Sender: news@ksr.com
Lines: 33