由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 什么时候写程序要注意这个问题?
相关主题
how to initialize this struct.关于buffer overflow
C 中的typedef 一问error of couting total line number in txt file on MSDOS (转载)
How to detect overflow in C?const_cast问题
pointer overflowint64_t printf
请教一道C语言的题目C/C++ __int64和long long, cross platform问题
is size_t recommended for 64-bit windows porting?a question about bitwise operation
问一个C语言中类型cast的问题c++怎么实现128bits的整型变量?
有段c++代码看不懂两个面世题
相关话题的讨论汇总
话题: int64话题: int32话题: int话题: typedef话题: your
进入Programming版参与讨论
1 (共1页)
e******r
发帖数: 220
1
int64 VS int32. 什么语言什么环境下要格外注意呢?
谢谢
h*******e
发帖数: 225
2
Your question is not well defined.

【在 e******r 的大作中提到】
: int64 VS int32. 什么语言什么环境下要格外注意呢?
: 谢谢

l*****d
发帖数: 359
3
first, you should know a 64-bit int has much larger range available than than 32-
bit int, right?
This kind of usage for portability. for example in a machine when 'int' is
4bytes and 'long' is 8bytes:
typedef int Int32
typedef long Int64
use Int32 and Int64 in your program.
When porting your program to a difference machine when 'int' is 8bytes, but
'short' is 4 bytes, you can just change the type define:
typedef short Int32
typedef int Int64
and you don't need to change anything in your program

【在 e******r 的大作中提到】
: int64 VS int32. 什么语言什么环境下要格外注意呢?
: 谢谢

c*****t
发帖数: 1879
4
There are a lot more issues. Things such as alignment, casting,
overflow, bit operation, dealing with I/O etc.

than 32-
but

【在 l*****d 的大作中提到】
: first, you should know a 64-bit int has much larger range available than than 32-
: bit int, right?
: This kind of usage for portability. for example in a machine when 'int' is
: 4bytes and 'long' is 8bytes:
: typedef int Int32
: typedef long Int64
: use Int32 and Int64 in your program.
: When porting your program to a difference machine when 'int' is 8bytes, but
: 'short' is 4 bytes, you can just change the type define:
: typedef short Int32

1 (共1页)
进入Programming版参与讨论
相关主题
两个面世题请教一道C语言的题目
A question about class sizeis size_t recommended for 64-bit windows porting?
C++ Q 108: swap问一个C语言中类型cast的问题
python question, easy one有段c++代码看不懂
how to initialize this struct.关于buffer overflow
C 中的typedef 一问error of couting total line number in txt file on MSDOS (转载)
How to detect overflow in C?const_cast问题
pointer overflowint64_t printf
相关话题的讨论汇总
话题: int64话题: int32话题: int话题: typedef话题: your