Joerg Schilling wrote:
Steve Bennett <[EMAIL PROTECTED]> wrote:


Joerg,

I can't quite see where you are going with all this.


Could you run another test?

Sure.

#include <stdio.h>

struct test1
{
    char blerg[1];
    char type[4];
    char flibble[3];
    char more[2];
} __attribute__((packed));

_Pragma("pack(1)") struct test2
{
    char blerg[1];
    char type[4];
    char flibble[3];
    char more[2];
};

int main (int argc, char **argv)
{
    printf("sizeof(test1) is %d\n", sizeof(struct test1));
    printf("sizeof(test2) is %d\n", sizeof(struct test2));
return 0;
}

What does this print?

sizeof(test1) is 10
sizeof(test2) is 12


What do you get from:

printf("vers %d\n", __STDC_VERSION__):

test2.c: In function 'main':
test2.c:5: error: '__STDC_VERSION__' undeclared (first use in this function)
test2.c:5: error: (Each undeclared identifier is reported only once
test2.c:5: error: for each function it appears in.)
test2.c:5: error: syntax error before ':' token


what do you get from:

struct test1
{
    char blerg[1];
    char type[4];
    char flibble[3];
    char more[2];
    char dummy[];
};

int main (int argc, char **argv)
{
    printf("sizeof(test1) is %d\n", sizeof(struct test1));
return 0;
}

sizeof(test1) is 12

Cheers,
Steve


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to