🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5692

Re: is f().c legal? How about (&(f()))->c ?

#5692
From: Mike McNelly
Date: Thu, 02 Feb 1989 16:48
21 lines
1307 bytes
> Here f() returns a structure.

> I am trying to figure out why C compilers like the latter expression
> and cant handle the first expression.  From what I gather from the
> ANSI specs, it says that a function call is not an lvalue (*).  Therefore
> the latter expression should be illegal (& requires an lvalue).

> As far as I can tell the first expression is legal... the . operator
> anly requires that the left hand side be a struct or union, it does not
> have to be an lvalue.

> So why is it that the C compilers (Sun and HP-UX's) both complain that
> the expression f().c is illegal, but run fine on (&(f()))->c.

> Seems to me that the logic is reversed here.

You're correct. We consider the behavior to be a bug, too. The problem of 
f().c has been fixed for release 6.5 on HP-UX Series 300 due to be released
"real soon now". I have no information on the (&(f()))->c problem.

Mike McNelly	mike%hpfcla@hplabs.hp.com
Technical Details
Message-ID: <12040012@hpfcdc.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!hplabs!hpfcdc!mike
References: <2648@vedge.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!hplabs!hpfcdc!mike
From: mike@hpfcdc.HP.COM (Mike McNelly)
Newsgroups: comp.std.c
Subject: Re: is f().c legal?  How about (&(f()))->c ?
Message-ID: <12040012@hpfcdc.HP.COM>
Date: 2 Feb 89 16:48:41 GMT
References: <2648@vedge.UUCP>
Organization: HP Ft. Collins, Co.
Lines: 21