predefined macros and "MAXFLOAT"

jsalter at slo.awdpa.ibm.com jsalter at slo.awdpa.ibm.com
Fri Aug 31 04:46:19 AEST 1990


In article <3583 at leah.Albany.Edu> rds95 at leah.Albany.Edu (Robert Seals) writes:
><math.h> defines MAXFLOAT as (*((float *) (&SFPMAX))), and SFPMAX
>is an extern unsigned int. So, it's impossible to do something like
>
>const float        lims[] = {1.0, 2.5, MAXFLOAT};
>
>because MAXFLOAT isn't constant.
>
>I suppose there's nothing really wrong with this, but it kinda
>bugs me that it's a variable. What do YOU think? Should it
>be just #defined to be the real value, or is this tricky business
>better?

It's both better and worse.  Yes, you can't use it your way, but the
rationale behind it being done the way it is is that the header files can
be common across platforms and the change needs to be a file in libc.a.

Considering that AIX is supposed to span the IBM hardware -
386/6000/370 - and since they all use different number
schemes (little-endian/big-endian/370-endian :-]), there is no way
to assume the representation for this value will be the same.

>And another thing, I can't find anyplace (even under "Predefined Macros"
>in the info explorer) what sort of groovy things are defined by the
>compiler - there must be something like "AIX" or "(C) IBM Corp" or
>something, eh?

Well, if you type "cc -v file.c", it will show you the following:

	xlcentry(...,-D_IBMR2,-D_AIX,...)

This would be a good place to start.  This is also mentioned in the "Porting
4.3 BSD programs to AIX Version 3.1" document.  If you don't have this let me
know and I'll send you a copy.

>rob
>  rob rob at asrcmv.albany.edu or rds95 at leah.albany.edu or rob at dinner.albany.edu


jim/jsalter  IBM AWD, Palo Alto  T465/(415)855-4427   VNET: JSALTER at AUSVMQ
Internet: ibmsupt!jsalter at uunet.uu.net         UUCP: ..!uunet!ibmsupt!jsalter 
	"Waco is a state of mind. Once you've gone there,
		you never come back" - Leo



More information about the Comp.unix.aix mailing list