ANSI C idea: structure literals (and short constants)

Henry Spencer henry at utzoo.uucp
Sun Mar 6 13:32:10 AEST 1988


> Aggregate constants are needed for data abstraction.

I guess I'm simple-minded; you'll have to explain in more detail.  I use
data abstraction routinely and have never *needed* aggregate constants.
I also find it difficult to envision a situation in which it would be
impossible to write

	static const struct thingie xxx = { ... };
	...
	foo = xxx;

instead of

	foo = { ... };

It is agreed that the latter form is more convenient.  But we were talking
about *needs*, in the context of an existing language, not about a wishlist
for a new language.

> The problem of deciding what their type is solved for now (and possibly
> always) by stating in the standard that such syntax has no inherent type
> and must be cast or assigned to the desired type.

[expletive deleted]  Speaking as a user and an implementor, this is an
abortion if there ever was one.  If one *must* add aggregate constants to
the language -- preferably as an experimental variant and not as part of
the effort to STANDARDIZE THE CURRENT LANGUAGE, DAMMIT! -- then the right
way to do it is probably the GNU compiler's approach, which avoids this
hideous botch entirely.
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list