[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rtl] gcc and g++ mbuff confusion. __attribute__((packed))
Am Don, 20 Apr 2000 schrieben Sie:
> On Thu, Apr 20, 2000 at 03:59:51PM +0200, Olaf Petzold wrote:
>
> > At first it's seems the compiler option -malign-double overides the
> > attributes, it's important to know. Secondly why is there a difference between
> > x1_t and x2_t ?? (it's interesting for me)
>
> Because you made a typo.
>
> typedef struct {
> char c;
> uint32 ui32;
> struct s2 {
> uint16 ui16[2];
> - };
> + } s2_m;
> } x2_t;
struct structTag {
int i;
};
struct structTag foo;
struct {
int i;
} structVar;
struct structTag2 {
int i;
} structVar2;
typedef struct structTag2 foo_t;
foo_t bar;
These all are working structures:
int main() /* useless -only check on derefence */
{
printf("foo.i = %d\n", foo.i);
printf("structVar.i = %d\n", structVar.i);
printf("bar.i = %d\n", bar.i);
return 0;
}
So there should be another reason. Maybee a question to *.comp.lang.c
Olaf