Re: 64 bit
Re: 64 bit
- Subject: Re: 64 bit
- From: David Fang <email@hidden>
- Date: Mon, 24 Dec 2007 20:12:48 -0500 (EST)
One option is to use -m64, which results in 64b long.
In general that's an extremely bad idea. It fundamentally changes the ABI,
so calling system routines (even fundamental things like the C runtime
library) might not work.
Hi,
I should qualify that -m64 means one should be explicitly using
the an LP64 ABI, which may not be the default on other 64b capable
systems. (Don't expect it to work on 32b machines either!) This is only
useful if the dependent libraries (libc, stdc++) are available in the 64b
ABI. Fortunately, they are available for darwin, and the static and
dynamic linkers will "do the right thing" in selecting the correct
architecture/ABI.
This gets around having to use the pedantically rejected "long long".
(ints are still 32b, pointers are 64b.)
...(and any "long" parameters to APIs you were using are going to get passed
as 64-bit values when the API expects them to be 32-bit)...
Correct me if I'm wrong, but the linker should recognize what
objects/archives were built for ABI32 vs. ABI64 (see otool -L, and
'file'), and avoid any cross-linking between the two. Is there another
way to 'break' the API that I'm missing? (There may be, I haven't tried
that hard.)
If you need *exactly* 64b, look for types like "int64_t" in the system's
type headers.
<inttypes.h> is probably the best place if you want portability, since it's
defined by C99 but was already present on some systems prior to that. I tend
to include <stdint.h> myself, but then I only care about systems with C99.
BSD also defines some similar types (in <sys/types.h>), though the unsigned
variants have an additional underscore (i.e. u_int16_t versus the C99
uint16_t).
I concur. This often requires some more configure-style checks to
determine which types are in fact available, which is a regular practice
to me, but not necessarily others. For a little more work, this choice
gives good mileage/portability.
Fang
David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
-- (2400 baud? Netscape 3.0?? lynx??? No problem!)
_______________________________________________
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
References: | |
| >64 bit (From: email@hidden) |
| >Re: 64 bit (From: Nick Zitzmann <email@hidden>) |
| >Re: 64 bit (From: Perry Winkel <email@hidden>) |
| >Re: 64 bit (From: Alastair Houghton <email@hidden>) |
| >Re: 64 bit (From: "Sean McBride" <email@hidden>) |
| >Re: 64 bit (From: Peter O'Gorman <email@hidden>) |
| >Re: 64 bit (From: Alastair Houghton <email@hidden>) |
| >Re: 64 bit (From: David Fang <email@hidden>) |
| >Re: 64 bit (From: Alastair Houghton <email@hidden>) |