[Python-Dev] GC head alignment issue

Tim Peters tim.one@home.com
Thu, 11 Oct 2001 20:54:29 -0400


[Paul Svensson]
> The usual thing to do in this situation would be:
>
> typedef union _gc_head {
> 	struct {
> 		union _gc_head *internal_gc_next;
> 		union _gc_head *internal_gc_prev;
> 		int internal_gc_refs;
> 	} gc_internals;
> 	double dummy;  /* force worst-case alignment */
> } PyGC_Head;
>
> #define gc_next	gc_internals.internal_gc_head
> #define gc_next	gc_internals.internal_gc_head
> #define gc_refs	gc_internals.internal_gc_refs

Yuck.  The less we abuse the preprocessor, the brighter the future of the
Python codebase, and that's a good concrete example of why.

and-that's-after-ignoring-the-redundant-redefinition-of-
    gc_next<wink>-ly y'rs  - tim