Steve Bennett <[EMAIL PROTECTED]> wrote:
> Results below.
>
> Joerg Schilling wrote:
> > Steve Bennett <[EMAIL PROTECTED]> wrote:
> >
> >
> >>Bad news!
> >>
> >>sizeof(test1) is 12
> >>offsetof(test1, more) is 8
> >>offsetof(test1, dummy) is 10
> >>
> >>I suppose this is the bit you are referring to:
> >>
> >>> the size
> >>> of the structure shall be equal to the offset of the last
> >>> element of an otherwise identical structure that replaces
> >>> the flexible array member with an array of unspecified
> >>> length.97)
> >>
> >>That 'of unspecified length' might well account for this behaviour.
> >
> >
> > I don't see this. Let us try to do what's in the text:
> >
> > Use this struct:
> >
> > struct test1 {
> > char blerg[1];
> > char type[4];
> > char flibble[3];
> > char more[2];
> > char dummy[];
> > };
>
> OK. Got the usual:
>
> sizeof(test1) is 12
> offsetof(test1, more) is 8
> offsetof(test1, dummy) is 10
>
> >
> > Replace the flex array with an an array of unspecified (which means
> > irrelevent) length:
>
> I don't think unspecified means irrelevant.
Note that a previous draft of ths C-99 standard did say:
"an array of lentgh 1"
My understanding of the change is that the people in the commitee did like to
say that the actual length does not matter.
> > struct test2 {
> > char blerg[1];
> > char type[4];
> > char flibble[3];
> > char more[2];
> > char dummy[1];
> > };
>
> And the result:
>
> sizeof(test1) is 12
> offsetof(test1, more) is 8
> offsetof(test1, dummy) is 10
>
> >
> > Now, sizeof(test1) needs to be == offsetof(test2, dummy);
> >
> > It seems that this is mot the case for GCC.
>
> So either this is the case because the you are misunderstanding
> the spec or because the GCC arm guys are misunderstanding the spec.
I am sorry but it seems that the GCC guys did missunderstand the spec.
> In any case, its irrelevant, since even if they agree with your view and
> "fix" it,
> we have the compiler we have. We have no other compiler.
> So we need a fix for mkisofs which works with this compiler as-is.
Please look at the end of mkisofs.h
A similar problem did exist with the old Sun K&R compiler and this may be why
GCC behanes the same: GCC did try to be as Sun compatible in the past as
possible.
I am currently thinking of a similar solution for your problem.
Jörg
--
EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
[EMAIL PROTECTED] (uni)
[EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily