3.7.2 External Object Definitions

Eyal Lebedinsky eyal at echo.canberra.edu.au
Thu Feb 7 17:49:14 AEST 1991


In <14327:Feb622:47:1391 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:

>Say struct foo's first element points to struct bar, and vice versa.
>Here's how to initialize mutually referencing static structures:

>  static struct {
>    struct foo f;
>    struct bar b;
>  } x = {
>    { &x.b },
>    { &x.f }
>  };

>Done. Most compilers will use fixed addresses for &x.b and &x.f, so this
>will be just as efficient as separate static structure declarations.
>  
[stuff deleted]

Yes, this would work. It is a practical solution and I may do it. But I
STILL want to know how to do it STRAIGHT, as ANSI intended. After all,
this is comp.std.c, not comp.lang.c.

>---Dan



More information about the Comp.std.c mailing list