This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] PR objc/6107, libobjc/objc/objc-api.h: Make protocols_listcount size_t, 64-bit big-endians
- From: Stan Shebs <shebs at apple dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 08 Apr 2002 19:03:37 -0700
- Subject: Re: [RFA:] PR objc/6107, libobjc/objc/objc-api.h: Make protocols_listcount size_t, 64-bit big-endians
- References: <Pine.BSF.4.30.0204082059120.81667-100000@dair.pair.com>
Hans-Peter Nilsson wrote:
>
> What I did was step through the code building up the types of
> _OBJC_CLASS_PROTOCOLS_MyObject and _OBJC_CLASS_METHODS_MyObject
> (generate_protocol_list and build_method_list_template
> respectively), hoping to find the best fix. Evidently,
> build_method_list_template *does* make its "count" member a
> proper int, with the surrounding type as a RECORD_TYPE (and the
> varying part an ARRAY_REF), letting the generic data-output
> machinery emit it right. In contrast, generate_protocol_list
> creates an ARRAY_REF for the whole thing, with the count thrown
> in as one of the elements. Thus "count" is made the size of the
> other elements; pointers. I don't understand the reasons for
> the record/array difference, but I don't really have a reason to
> doubt correctness besides the bug at hand. (Besides, I'm not
> good at trees.)
Personally, I think the count should be 32 bits, because programs
aren't likely to have even a billion protocols, so you're wasting
4 bytes. On the other hand, people using 64-bit systems are
used to wasting space everywhere :-), and maybe there would be
an alignment advantage, so let's go with using size_t for the
count.
(The use of an array rather than a record type looks like a
sloppiness to me; objc-act.c code should mirror the .h types
exactly.)
> Ok for trunk and 3.1 branch?
Yes, thanks.
Stan