🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5420

Re: (&f())->member, was: union *func()

#5420
From: Walter Murray
Date: Wed, 02 Nov 1988 16:30
23 lines
1238 bytes
David Lai writs:

> On a related issue, the C language specifies that a function call is never an
> lvalue, yet most compilers I've used allow:

> 	struct xxx f();
> 	dummy = (&f())->member;

> Does anyone know if this is contrary to ANSI?
-- 
Yes, this is contrary to ANSI.  A conforming implementation will have
to diagnose this, as it violates a constraint in Section 3.3.3.2.  A
function call cannot be used as the operand of the unary & operator.

You will find the same restriction in Harbinson & Steele, 2nd ed, p. 139.
"A function call cannot produce an lvalue. ... The operand of a
unary address operator & must be an lvalue."

For that matter, K&R seems to be just as strict.  See p. 187.


Walter Murray
All opinions expressed are my own.
Technical Details
Message-ID: <16490009@hpcllca.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!husc6!bbn!rochester!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!mimsy!eneevax!haven!purdue!decwrl!hplabs!hpda!hpcuhb!hpcllla!hpcllca!walter
References: <1799@vedge.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!husc6!bbn!rochester!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!mimsy!eneevax!haven!purdue!decwrl!hplabs!hpda!hpcuhb!hpcllla!hpcllca!walter
From: walter@hpcllca.HP.COM (Walter Murray)
Newsgroups: comp.std.c
Subject: Re: (&f())->member, was: union *func()
Message-ID: <16490009@hpcllca.HP.COM>
Date: 2 Nov 88 16:30:30 GMT
References: <1799@vedge.UUCP>
Organization: HP NSG/ISD California Language Lab
Lines: 23