gnustep-dev
[Top][All Lists]
Advanced

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

Re: Cocoa compatability header file


From: Kazunobu Kuriyama
Subject: Re: Cocoa compatability header file
Date: Wed, 21 Apr 2004 06:02:59 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4) Gecko/20030624 Netscape/7.1

Fred Kiefer wrote:

Kazunobu Kuriyama wrote:

Fred Kiefer wrote:

I would like to add a new header file to the GNUstep GUI module, which would be placed in a subdirectory Cocoa and would help with porting stuff from Apple to GNUstep. In this file we could put all the extensions we don't want to see in the GNUstep headers. My current working copy of this file is attached. I don't see any problem for the rest of GNUstep here, but as some GNustepers are rather Cocoa sceptic I would like to give these a chance to oppose this addition.


The general idea looks ok. But are you sure the proposed header can live with C99 and (reportedly coming) ObjC++? I mean, the typedef and the following define's
seem to be problematic.


No, I am not sure. If you have any suggestions on how to make this header file safer against upcoming compiler changes these are very welcome.

Honestly, I know almost nothing about ObjC++. So I'm happy if someone who knows the
stuff well corrects mistakes possibly made in the code below.

Since bool has been a predefined type in C++ and C99 (AFAIK, as of GCC 3.1 for the
latter), I think the following makes the thing safer:

#ifndef GCC_VERSION
#if __GNUC__ > 3
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCH_LEVEL__)
#else
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
#endif

#if (!defined(__cplusplus)) || GCC_VERSION < 30100
typedef BOOL bool
#define false NO
#define true  YES
#endif

(In my view, this sort of stuff should go into a header which is supposed to be included in almost all of the GNUstep headers, say GSConfig.h. Is this wrong?)

But I am rather sure that Apple must use similar definitions, this is why Cocoa code wont compile with GNUstep in the moment. And personally I would always recomment not to include this header into your own code. It is just there for the porting from Cocoa!

I think you are absolutely right.

Cheers,
- Kazunobu Kuriyama





reply via email to

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