Robert Feldt [mailto:feldt / ce.chalmers.se] wrote:

> I agree it seems pretty straightforward and useful. It still 
> depends on the answer to the 3 question above. But I guess 
> it's unlikely a C compiler would do it in any other way.
> 
> This "cheat" at least works on gcc 3.2 20020908 on cygwin and 
> 3.2.3 20030422 on Gentoo linux.

Well, I'm very much a C novice, but from my limited understanding of how
structs work, it seems that in a case like:

  typedef struct {int a, b;} inner;
  typedef struct {int c, d; s1 e;} outer;

That outer must be stored like:

  int
  int
  int
  int

I think nesting a struct simply tells C to allocate an additional
sizeof(inner) in the outer struct, and the compiler then translates an
outer.inner.whatever reference to access the correct memory in outer. But
that's mostly a guess.


Nathaniel

<:((><