[PATCH][win32] problems compiling bzrlib/_dirstate_helpers_c.pyx with MSVC

Alexander Belchenko bialix at ukr.net
Tue Jul 31 10:13:36 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lukáš Lalinský пишет:
> On Ut, 2007-07-31 at 07:06 +0300, Alexander Belchenko wrote:
>> 1) you're using #include <stdint.h>, but MSVC is not C99 compiler, and don't have such
>> header.
>>
>> 	Actually you need only `typedef int intptr_t` from this header,
>> 	but Pyrex is smart enough to substitute intptr_t with int in
>> 	generated C-code, so actually stdint.h is not used at all.
> 
> This is not a good idea, it will break on 64-bit platforms. VC7 (which
> is the preferred compiler for Python extensions) has intptr_t in io.h --
> does Pyrex support #ifdefs so we can do something like?
> 
> #ifdef _MSC_VER
> #include <io.h>
> #else
> #include <stdint.h>
> #endif

I don't know is it bug in Pyrex or in our usage of Pyrex, but I repeat one more time:

	Pyrex substitute intptr_t with int in
	generated C-code, so actually nor stdint.h nor intptr_t
	is not used at all.

intptr_t is not present in generated C-code. So, it's already
breaks compatibility with 64-bit platform.

But if you look for actual usage in _dirstate_prefix_c.pyx,
you'll see that after cast a pointer to intptr_t
then code use only last-significant 2 or 3 bits of value.

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGrv1AzYr338mxwCURAga6AKCSc8VokANqdGYGg+Hamwfdt4nMJACfTaKO
GP6lu1WyW22Kv9EXu4uQUA0=
=0ah4
-----END PGP SIGNATURE-----



More information about the bazaar mailing list