This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libobjc] May I tweak objc-api.h?


Ziemowit Laski wrote:
> If you rename 'class' to 'super_class' and reference it as
> 'super_class',
> then this will work in all four of our C flavors, so I'm not sure I
> understand
> your question...

If we reference the field as "super_class", we won't be compatible with
gcc <= 3.4. That isn't an option for GNUstep.

>  Or are you suggesting that we do something like
> 
>    #ifdef __cplusplus
>      Class super_class;
>    #else
>      Class class;
>    #endif

Yes. Not pretty, but FWIW, the same pattern can be seen in several other
headers here.

> While possible, I'd submit that this approach will be more confusing
> in the long run.

It isn't optimal, but that's the price of compatibility. We do need some
way of writing code that will work with "all" versions of gcc. This
can't be the first time there's a name conflict like this, so there may
be some established way of dealing with it. #ifdef __cplusplus is the
only one I recall seeing.

- Alexander Malmberg


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]