Reputation:
I am working on project (c++ integration with Python) which has migrated to 32 bit machine to 64 bit machine. In Python, C long is mapped with Python Integer. SO I can not change in Python Interface(client interface) and always gets overflow error from python client. it was working fine in 32 bit machine
So I have following solution
1)convert all long to int in 64 bit machine.
2)Declare 32 bit long in 64 bit machine.
Do we have any general solution/header file which give me option to declare 32 bit datatype always So I can handle this issue in more general way.
I know it may be small issue but I am not able to find general solution.
Upvotes: 0
Views: 1143
Reputation: 1
standard C99 (and newer) has <stdint.h>
header defining int32_t
for 32 bits signed integers (and many other types) and recent C++ have <cstdint>
If you care about bignums (arbitrary precision numbers), be aware that it is a difficult subject and use some existing library, like GMP.
Upvotes: 3
Reputation:
Do we have any general solution/header file which give me option to declare 32 bit datatype always?
Yes, there is, since C99.
#include <stdint.h>
uint32_t foo;
Upvotes: 4