bug-gnustep
[Top][All Lists]
Advanced

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

Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)


From: Georg Fleischmann
Subject: Re: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Date: Mon, 27 Jul 2009 11:39:49 +0800

Hi,

#ifndef MAC_OS_X_VERSION_10_5
- (BOOL) boolValue
{
   ...
}
#endif

Well that version will work for the current version but will compile it
again for future versions.  My best bet would be something like the
attached patch.  Richard, is this usage of the API macros legitimate?

From my understanding it should continue to work.
MAC_OS_X_VERSION_10_5 is supposed to be defined on Apple 10.5 systems and later, but not before.


#if OS_API_VERSION (MAC_OS_X_VERSION_10_2,MAC_OS_X_VERSION_10_5)


Looks like your patch does work also but I don't understand why, for in my test on 10.4.11, MAC_OS_X_VERSION_10_5 is clearly undefined.
And the macro and the values look like this:

#define OS_API_VERSION(ADD,REM) \
(!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM))

MAC_OS_X_VERSION_MAX_ALLOWED = 1040, so GS_OPENSTEP_V would be 1040.
ADD = 1020
REM is undefined


Maybe, to make it fail-safe add a test if MAC_OS_X_VERSION_10_5 is defined?

#if !defined(MAC_OS_X_VERSION_10_5) || OS_API_VERSION (MAC_OS_X_VERSION_10_2,MAC_OS_X_VERSION_10_5)
  ...
#endif

I tested this on 10.4 and it works.

Best wishes,
Georg


On 26.07.2009, at 21:01, David Ayers wrote:

Hey,

Am Sonntag, den 26.07.2009, 11:10 +0800 schrieb Georg Fleischmann:
I believe this is not correct.  -boolValue is documented in Cocoa
to do
pretty much what the compatibility implementation does. So I believe
the "correct" fix would be to simply remove our compatibility
category.

[NSString boolValue] has just been added in Mac OS 10.5, but
basically the method does the same thing.
I feel it still makes sense to have this method in GSCompatibility,
since Mac OS 10.4 is good.


It would be great if someone who understands the macro magic wrt. OS X
versions could compile the category conditionally and sync the
implementation.

The following does it:


#ifndef MAC_OS_X_VERSION_10_5
- (BOOL) boolValue
{
   ...
}
#endif

Well that version will work for the current version but will compile it
again for future versions.  My best bet would be something like the
attached patch.  Richard, is this usage of the API macros legitimate?

Cheers,
David

PS: The patch is untested since I do not have an Cocoa version.


--
David Ayers          Fellow of the Free Software Foundation Europe
http://www.fsfe.org                     http://fellowship.fsfe.org

<base.patch>





reply via email to

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