Portability Question

Jonathan P. Leech jon at cit-vax.arpa
Sat Nov 23 10:51:52 AEST 1985


    If I declare structures containing only one  data  type  (doubles)
	like this:

    struct a {
	double pt[3],
	       color[3];
    };

    struct b {
	double pt[3],
	       color[3],
	       normal[3];
    };

    is it safe	to  assume  that  they	are  equivalent  in  terms  of
	alignment and size to arrays of equivalent contents, i.e.

    double a_dummy[6],
	   b_dummy[9];

    Harbison & Steele makes me believe this, but  I'd  appreciate  any
	reliable information to the contrary. This question arises  in
	the context of a routine which needs to operate on  structures
	containing different amounts of  information  above  a	common
	base (polygon vertex location).

    Thanks,
    Jon Leech (jon at cit-vax.arpa)
    __@/



More information about the Comp.lang.c mailing list