Martin Buchholz writes:
>>>>> "Colin" == Colin Rafferty
<colin(a)xemacs.org> writes:
Colin> Martin Buchholz writes:
Colin> Björn Torkelsson writes:
>>>> The latest version of XEmacs updated from CVS
yesterday (2000-04-03) is
>>>> uncompilable under SGI IRIX with the naitive SGI cc compiler.
Colin> I submitted the patch to xemacs-patches to undo Martin's changes
Colin> already. Here it is for your personal enjoyment.
Colin> * alloc.c (size_vector):
Colin> (make_vector_internal):
Colin> (make_bit_vector_internal):
Colin> (sweep_bit_vectors_1):
Colin> Replace calls to offsetof with STRETCHY_STRUCT_SIZEOF macro.
>> I don't like reversing this change. Is the code in
XEmacs
>> ANSI-compliant? I think so.
Colin> I don't. While I don't have a copy of the standard, SGI compilers are
Colin> very good at following the standards.
Your intuition is correct. As usual, I was wrong. Arguments of
this
type are best won by citing chapter and verse.
Thanks. If I had a copy of the standard, I would certainly have
cited.
We can put back the original code, but I would like to revisit the
naming scheme. "stretchy struct" is a phrase adopted from some
proprietary debugging tool (Insure, if I recall). This practice has
not been legal ANSI C, but all known compilers support it.
Including IRIX :-). Given how a C compiler works, I can't imagine how
one couldn't support flexible arrays.
So let's audit all the occurrences of offsetof in the sources,
and
change the ones required back to use STRETCHY_STRUCT_SIZEOF, except
let's use a naming convention like this:
#define FLEXIBLE_ARRAY_STRUCT_SIZEOF(flexible_array_structtype,
flexible_array_member, flexible_array_length) \
The auditing part is easy. The SGI compiler does it for me.
In about five minutes, I'll submit a new patch that uses
FLEXIBLE_ARRAY_STRUCT_SIZEOF instead of STRETCHY_STRUCT_SIZEOF.
--
Colin