ANSI C idea: structure literals (and short constants)

Peter da Silva peter at sugar.UUCP
Sat Mar 12 17:06:28 AEST 1988


In article ... henry at utzoo.uucp (Henry Spencer) writes:
> 	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.

I implemented just this construct in a copy of the Small-C compiler I was
playing around with about 6 years ago. I had just picked up a copy of the
BCPL book and wanted to play with the concepts.

I also implemented this:

	foo = { for(i = 0; i < 10; i++) if(...) break; i; };

in analogy to the BCPL:

	foo = $( ... resultis i; $)

Back to the subject.. the problem of what type an aggregate constant is
is a lot easier in Small-C. It's only got 4 types. But if you need prior art
to consider this, well here's two examples (half-smiley).

> way to do it is probably the GNU compiler's approach, which avoids this
> hideous botch entirely.

What's the GNU compiler's approach?
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.



More information about the Comp.lang.c mailing list