`open ended' struct declarations (was Re: question on opendir, readdir, etc.)

Joe Porkka jap at convex.cl.msu.edu
Wed Dec 5 14:59:44 AEST 1990


martin at mwtech.UUCP (Martin Weitzel) writes:

>In article <14616 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>>In article <4776 at rossignol.Princeton.EDU> tr at samadams.princeton.edu (Tom Reingold) writes:

>>>How can it work?  And why was this kludge put there?
>>
>>What do you mean, how can it work?  If you look at the sources you

>But this *is* confusing to many who are accustomed to use a given

>(Somehow they seem to trust that some "magic" will get it right - but
>*if* this works, it is by accident not by magic).

Not so much magic since they wrote the compiler.....

Pehaps it should be viewed as a defiency in the C language.
If we can functions  foo(arg1, arg2, ...)
why can't we have structs
	struct my_struct {
		struct  somedata sd;
		int length;
		char moredata[...]; /* Even better moredata[length] */
	}
then of course more syntax is needed to actually declare objects
of type my_struct which includes the exact size.



More information about the Comp.lang.c mailing list