You can reporoduce problem easily by D script shown below.

================
struct foo {       /* size: */
    char f1;       /* 1 */
                   /* 3 (padding for alignemt of f2) */
    void* f2;      /* 4 (for 32bit env) */
};                 /* => 8 */

struct bar {       /* size: */
    char b1;       /* 1 */
                   /* 3 (padding for alignment of f2) */
    struct foo b2; /* 8 */
};                 /* => 12 */

struct baz {       /* size: */
    void* b1;      /* 4 (for 32bit env) */
    char b2;       /* 1 */
                   /* 3 (padding for alignemt of next array element) */
};                 /* => 8 */

BEGIN {
    printf("sizeof(struct foo)=%d\n", sizeof(struct foo));
    printf("sizeof(struct bar)=%d\n", sizeof(struct bar));
    printf("sizeof(struct baz)=%d\n", sizeof(struct baz));
    exit(0);
}
================

For C/C++ compatibility:

(1) "sizeof(struct bar)" must be 12, but 9. "3 bytes padding" before
    "b2" seems to be ignored.

(2) "sizeof(struct baz)" must be 8, but 5. "3 bytes padding" after
    "b2" seems to be ignored.
-- 
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to