discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mike Stump
Subject: Re: [libobjc] May I tweak objc-api.h?
Date: Fri, 6 Feb 2004 15:05:09 -0800

On Friday, February 6, 2004, at 02:02  PM, Alexander Malmberg wrote:
Ziemowit Laski wrote:
   typedef struct objc_super {
id self; /* Id of the object sending
                                                 the message. */
Class class; /* Object's super class.
*/
   } Super, *Super_t;
[snip]
So, do you think it would be OK to rename 'class' above to, say,
'super_class'?

This field is used in GNUstep. What do you propose that code should do
to work with both versions? Change the name only if __cplusplus is
defined?

There is excellent prior art here, with exactly this issue. The case came up with X11 and C++ and a keyword, probably class, and in some area that did affect api code.

The solution they took, was to migrate to a new name, the same new name, in C and C++, I think we should do the same.

Something like:

struct A {
        int class;
};

became:

struct A {
        int super_class;
};

and they took the API hit.

For user code, they can do:

#if (__GNUC_ == 3 && __GNUC_MINOR__ < 4)
#define super_class class
#

and then use super_class everywhere. It compiles on both, and it easy to maintain, as long as one doesn't get hit with other things called super_class. :-(

The change breaks all user code that uses class, but sometimes an easy to describe system is easier to fix than an insanely complex one.

The X11 folks grappled with this, gosh, a long long time ago. Time to enter the 90s. :-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]