Steve Bennett <[EMAIL PROTECTED]> wrote: > I don't think unspecified means irrelevant. > > > > > 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.
OK, now I have access to the printed standard at work.... Working draft 1997-11-21: -------> As a special case, the last element of a structure may be an incomplete type. This is called a flexible array member, and 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 one element. <------ It is obvious that the new version of the text has been made more universal from a theoretical standpoint (the new text does not allow the compiler to behave different in case that the size of the replaced last element differs from 1) but unfortunately this reduces readability for the first attempt to read.... The recent C-99 text basically says the same as the important part of the new sentence is that the size of the structure shall be equal to the offset of the flexible array member. However, I understand that it would take some time to fix the GCC and to wait until the fixed gcc appears at end user systems. What the last 10 lines in mkisofs.h show is that it seems to be usual (not only for GCC) to tail pad structures on some architectures. We need to find a different way to solve your problem that is insensitive to compiler bugs. Thank you for pointing to this 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