Article View: comp.std.c
Article #6125Re: "expandable" structs with last element declared using [1]
From: Larry Westerman
Date: Tue, 19 Dec 1989 21:14
Date: Tue, 19 Dec 1989 21:14
27 lines
1467 bytes
1467 bytes
In article <477@longway.TIC.COM> uunet!sq!msb (Mark Brader) writes:
>The issue is the legality of:
>
> struct foo_struct {
> int bar;
> char baz[1];
> } *foo;
>
> foo = (struct foo_struct *) malloc(sizeof(struct foo_struct)+1);
> foo->baz[1] = 1; /* error? */
>
Although it is not relevant to the question of the legality of the
structure declarations and usage such as the above example, it is worth
noting that the Stepstone implementation of Objective C uses exactly
this technique for the creation and manipulation of objects with
indexed instance variables.
"A man hears what he wants to hear and disregards the rest"
Larry Westerman Quantitative Technology Corporation Beaverton OR 503-626-3081
...verdix! or ...sequent! qtc!law
--
"A man hears what he wants to hear and disregards the rest"
Larry Westerman Quantitative Technology Corporation Beaverton OR 503-626-3081
...verdix! or ...sequent! qtc!law
Technical Details
Message-ID:
<1970@qtc.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!ucsd!ogicse!verdix!qtc!lawReferences:
<UZTerlu00VcJEDulRd@andrew.cmu.edu> <463@cpsolv.UUCP> <477@longway.TIC.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!ucsd!ogicse!verdix!qtc!law From: law@qtc.UUCP (Larry Westerman) Newsgroups: comp.std.c Subject: Re: "expandable" structs with last element declared using [1] Message-ID: <1970@qtc.UUCP> Date: 19 Dec 89 21:14:09 GMT References: <UZTerlu00VcJEDulRd@andrew.cmu.edu> <463@cpsolv.UUCP> <477@longway.TIC.COM> Reply-To: law@qtc.UUCP (Larry Westerman) Organization: Quantitative Technology Corporation, Beaverton OR Lines: 27