Re: Making GCC less sensitive about duplicate typedefs?
Re: Making GCC less sensitive about duplicate typedefs?
- Subject: Re: Making GCC less sensitive about duplicate typedefs?
- From: "Mark Wagner" <email@hidden>
- Date: Tue, 20 Jun 2006 12:22:27 -0700
On 6/20/06, Steve Christensen <email@hidden> wrote:
On Jun 20, 2006, at 10:33 AM, Mark Wagner wrote:
> On 6/19/06, Justin C. Walker <email@hidden> wrote:
>>
>> On Jun 19, 2006, at 16:17 , Mark Wagner wrote:
>>
>> > The following C code compiles just fine in CodeWarrior, but gcc
>> gives
>> > an error of "error: conflicting types for 'dummy'". How do I
>> get this
>> > sort of thing to compile with gcc?
>>
>> What version of the compiler are you using? On 10.4.6, with Xcode
>> 2.3 installed, both gcc 3.3 and gcc 4.0 do not give this error. It
>> complains that you are redefining a variable, which I think is the
>> right response.
>
> I'm using gcc 3.3, gcc 4.0, and gcc 3.4.2 for Windows, all of which
> give the error. The actual situation is a bit more complicated: there
> are about a dozen types (UInt8 and similar) that are being defined in
> both a system header and a third-party header, with identical
> definitions.
Well, looking at things from a different perspective (one that was
previously mentioned), is it reasonable to just modify the third-
party header with a #ifdef around the duplicated typedefs so that if
the system header already defined them, they aren't defined twice?
Depending on where the third-party headers come from, how often they
change, etc., you could just fix the problem once and not have to
look at potentially fragile compiler workarounds.
The third-party headers change about once in a blue moon, but the
person who wrote them was in love with macros: the actual typedefs are
about a half-dozen macro calls deep, and the type-defining macro
generates not only a type, but at least a half-dozen related types:
constants, pointers, const pointers, alternate names for pointers,
etc. The system headers don't include these related types.
Oh yes, and it turns out that "Byte" is typedef'd in at least three
different sets of third-party headers.
--
Mark Wagner
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden