Path: 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 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.