Re: cpp -dM & MAC_OS_X_VERSION_MIN_REQUIRED
Re: cpp -dM & MAC_OS_X_VERSION_MIN_REQUIRED
- Subject: Re: cpp -dM & MAC_OS_X_VERSION_MIN_REQUIRED
- From: james tittle <email@hidden>
- Date: Wed, 18 May 2005 11:38:23 -0400
...ahh, what would we do without typos? Of course here I was trying
to say that in some earlier than 10.4 (or was it 10.3?) installs,
float versions of sqrt, cos, sin, tan, etc...weren't in math.h, and
so had to be hand-defined...
...plus, my main question was something else...
thnx,
james
On May 18, 2005, at 10:41 AM, Graeme Mathieson wrote:
On 18 May 2005, at 15:16, james tittle wrote:
I ask because it turns out that sqrtf and friends are now defined
in /usr/local/architecture/ppc/math.h, but they weren't in >10.4...
The Single Unix Specification[1] defines sqrtf() and friends as
being available as a result of #including <math.h>. You shouldn't
need to root around and include the actual header file it winds up
being defined in; this breaks portability as you've discovered. :-)
Tested on 10.4:
mathie@Tandoori:misc$ cat foo.c
#include <stdio.h>
#include <math.h>
int main(void) {
printf("Square root of 8 is: %f\n", sqrtf(8.0));
return 0;
}
mathie@Tandoori:misc$ make foo
cc foo.c -o foo
mathie@Tandoori:misc$ ./foo
Square root of 8 is: 2.828427
[1] http://www.unix.org/single_unix_specification/ - need to
register for access.
--
Mail: email@hidden | Web: http://woss.name/
AIM: Math1e | PGP: 1024D/D72F2737
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden