[mod.std.c] mod.std.c Digest V7#2

osd7@homxa.UUCP (Orlando Sotomayor-Diaz) (06/19/85)

From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Tue, 18 Jun 85       Volume 7 : Issue   2 

Today's Topics:
                        syntax vs constraints
              Union Initialization - can it have braces?
----------------------------------------------------------------------

Date: 23:48 June 7, 1985
From: sfbc!lr
Subject: syntax vs constraints
To: houxm!homxa!osd7

Several readers of the ANSI draft have observed that the syntax
allows constructions with absurd semantics.  These are not bugs.
The syntax must be read together with the "constraints" to see
what the grammar really allows.  Some constraints (such as those
prohibiting type-clashes of various kinds in assignment) are
difficult to express in a phrase-structure grammar; some (such
as those prohibiting type comnbinations such as "unsigned float")
obviate the need to list all permissible type combinations in the
syntax.  The number of productions would be enormous, especially
as the order of storage-class and type specifiers is unspecified.
("int long unsigned static x = 0;" is perfectly grammatical C,
though rather weird stylistically!)

We appreciate the efforts of readers to improve the draft, and
hope they will examine the grammar including constraints as
well as syntax.

Larry Rosler, X3J11 redactor.

------------------------------

Date: 18 Jun 85 17:46:02 +1000 (Tue)
From: David A. Price <seismo!munnari!mulga.oz!dap>
Subject: Union Initialization - can it have braces?
To: std-c@cbosgd

	The C Draft says in  5.6 Initialization  (just before the
Examples)   "When the declared object is a union, the initializer
initializes the  member  that appears first in the declaration of
the union".
	Does a union initializer take a (possible) pair of braces
in its own right?  Is a union an "aggregate" in the Draft's usage
of the term?   I cannot find where the Draft defines its usage of
"scalar" and "aggregate".
	Hence, is	  static union { int i; } a[2] = { 0, 1};
a completely-bracketed initialization?

David Price				       seismo!munnari!dap

Department of Computer Science,
University of Melbourne,
Parkville, 3052.     AUSTRALIA.

[ The author refers to the 11/12/84 draft, I guess.  The 85-045
draft says in section C1.2.5:

"Arithmetic types and pointers are collectively called scalar types.
Arrays and structures are collectively called aggregate types."

Back in section 5.6:

"...the [aggregate] initializer is a brace-enclosed list of initializers
for the members of the aggregate, written in increasing subscript or member
order."

Let's not begin again the "union initialization" debate.

			-- Mod --
]

------------------------------

End of mod.std.c Digest - Tue, 18 Jun 85 23:45:11 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.