Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!henry
From: henry@utzoo.UUCP (Henry Spencer)
Newsgroups: net.lang.c
Subject: inconsistency in C manual 
Message-ID: <3623@utzoo.UUCP>
Date: Sun, 11-Mar-84 00:24:05 EST
Article-I.D.: utzoo.3623
Posted: Sun Mar 11 00:24:05 1984
Date-Received: Sun, 11-Mar-84 00:24:05 EST
Organization: U of Toronto Zoology
Lines: 35

There is an inconsistency of a somewhat annoying nature between the
V7 C Reference Manual / appendix to K+R and the V7 (at least) cc:
Hear ye section 7.1 of the manual:

	...A primary expression followed by a dot followed by an
	identifier is an expression.  *The first expression must be
	an lvalue naming a structure or union*...

Consider the following:

	struct foo { int bar; };

	extern struct foo f();

	g()
	{
		int x;

		x = f().bar;
	}

By the same section of the white book, a function call is *not* an
lvalue.  Yet the V7 compiler (and probably most compilers) takes this
program fragment without complaint.

Clearly the compilers are doing the right thing; picking out one field
of a structure returned value is a reasonable thing to do.  And clearly
the manual is out of date on this point, since structure returns were a
late addition to the language.  But how does one fix the manual to permit
this particular usage?  Any ideas?  Do any of the more recent C manuals
shed any light on this?  (We have the System V distribution but it's not
where I can get at it quickly.)
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry