GMP and 64-bit systems
NightStrike
nightstrike at gmail.com
Sun Jun 1 17:46:27 CEST 2008
On 6/1/08, Joerg Arndt <arndt at jjj.de> wrote:
> * librik at panix.com <librik at panix.com> [Jun 01. 2008 18:25]:
> > A conclusion: any integer type intended to be 32 bits on 32-bit
> > systems and 64 bits on 64-bit systems cannot be a basic C type. It
> > must be a typedef type, whose identity is controlled by an #ifdef in
> > some header file.
>
> Yes that's the price for the full adherence to the standard. I
> suggest sticking to LP64 (and saying so in the doc!), and, when it's
> not there, bailing out with an error (or warning).
> Or falling back to a safe but potentially slow code branch.
So you don't want to support Win64 at all? Oh, how delightful...
If you don't understand *why* Microsoft went with the model they
chose, then maybe you should take a few minutes to learn. They have
published several informative documents on msdn which explain -- in
great detail -- why they went with int=long=32. Before you just make
blanket statements (and repeat yourself 5 times with the same blanket
statement) that a model is not "sane", you would do well to know a bit
more about what you are evaluating.
It was said perfectly well earlier in this thread -- if you assume
that you can freely cast between pointers and longs, you are a bad C
programmer and you are writing bad C code. End of story.
Use size_t for unsigned, ssize_t for signed, and intptr_t for any data
structure that is storing a pointer. Why is that so difficult?
More information about the gmp-discuss
mailing list