[Pythonmac-SIG] MacOS X _POSIX_C_SOURCES and stuff
Bill Northcott
w.northcott at unsw.edu.au
Wed Feb 8 13:18:32 CET 2006
Not happy with the replies I received, I have ground this very small
and think I now understand what is going on.
Try the following test program:
#define _POSIX_C_SOURCE 200112L
#include <Carbon/carbon.h>
int main ()
{
}
Save it once as posix_test.c and again as posix_test.cpp. Try to
compile them:
[PM-G5BN:Shared/Public/Python] billn% gcc posix_test.c
[PM-G5BN:Shared/Public/Python] billn% gcc posix_test.cpp
In file included from /System/Library/Frameworks/
CoreServices.framework/Frameworks/CarbonCore.framework/Headers/
CarbonCore.h:65,
from /System/Library/Frameworks/
CoreServices.framework/Headers/CoreServices.h:21,
from /System/Library/Frameworks/Carbon.framework/
Headers/carbon.h:20,
from posix_test.cpp:3:
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/MacMemory.h: In
function `void BlockZero(void*, long int)':
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/MacMemory.h:1585: error: `
bzero' undeclared (first use this function)
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/MacMemory.h:1585: error: (Each
undeclared identifier is reported only once for each function it
appears
in.)
In file included from /System/Library/Frameworks/
CoreServices.framework/Frameworks/CarbonCore.framework/Headers/
CarbonCore.h:161,
from /System/Library/Frameworks/
CoreServices.framework/Headers/CoreServices.h:21,
from /System/Library/Frameworks/Carbon.framework/
Headers/carbon.h:20,
from posix_test.cpp:3:
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h: In
function `long double gammal(long double)':
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h:2031: error: `
gamma' undeclared (first use this function)
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h: In
function `long int rinttoll(long double)':
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h:2145: error: `
rinttol' undeclared (first use this function)
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h: In
function `long int roundtoll(long double)':
/System/Library/Frameworks/CoreServices.framework/Frameworks/
CarbonCore.framework/Headers/fp.h:2183: error: `
roundtol' undeclared (first use this function)
[PM-G5BN:Shared/Public/Python] billn%
The POSIX specifications only cover C not C++. It is nonsense to
define _POSIX_C_SOURCE or _XOPEN_SOURCE in a C++ program. So it
seems to me that the correct fix for the problems is not to to drop
the _POSIX_C_SOURCE and _XOPEN_SOURCE definitions. That is throwing
the baby out with the bathwater. The right approach is to wrap them
in '#if !defined(__cplusplus).
Nothing I have seen so far provides any evidence to contradict
Apple's assertion that Tiger is POSIX compliant.
Cheers
Bill Northcott
More information about the Pythonmac-SIG
mailing list