由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to detect overflow in C?
相关主题
什么时候写程序要注意这个问题?一个函数指针的问题
pointer overflowpython 如何查找数值并判断是否空
a question about bitwise operation再请教一个c++的简单问题(enumerated constant)
how to initialize this struct.C 中的typedef 一问
这道题有什么好思路?一道面试题
get_innerHTML需要什么样的permission?is size_t recommended for 64-bit windows porting?
如何才能到达内存带宽的极限呢?C# binary file reading problem
紧急求助,C语言面试题about layout of List in C#
相关话题的讨论汇总
话题: overflow话题: detect话题: int32话题: bit话题: 64
进入Programming版参与讨论
1 (共1页)
a******g
发帖数: 320
1
Overflow like: Try to use an int32 type to represent a 64-bit integer. Is
there any command or easy way to judge this in C?
Thanks a lot!
Xuan
z**e
发帖数: 2
2
http://lists.linux.org.au/archives/linuxcprogramming/2002-June/msg00028.html

【在 a******g 的大作中提到】
: Overflow like: Try to use an int32 type to represent a 64-bit integer. Is
: there any command or easy way to judge this in C?
: Thanks a lot!
: Xuan

t*******l
发帖数: 3662
3
if your platform supports 64-bit integer,
and you only use int32 to store some final results, maybe
you can use your 64-bit int to do the calculation, and
then right-shifted 32 bit and check if it is zero before
assigning the value to your int32.

【在 a******g 的大作中提到】
: Overflow like: Try to use an int32 type to represent a 64-bit integer. Is
: there any command or easy way to judge this in C?
: Thanks a lot!
: Xuan

g***p
发帖数: 139
4
google PCL(performance counter library) it will count how many overflows in
your subroutine?

【在 a******g 的大作中提到】
: Overflow like: Try to use an int32 type to represent a 64-bit integer. Is
: there any command or easy way to judge this in C?
: Thanks a lot!
: Xuan

1 (共1页)
进入Programming版参与讨论
相关主题
about layout of List in C#这道题有什么好思路?
C问题,被64bit iPhone搞晕了get_innerHTML需要什么样的permission?
wpf c#如何定义个常变量?如何才能到达内存带宽的极限呢?
为什么大家不喜欢golang的switch?紧急求助,C语言面试题
什么时候写程序要注意这个问题?一个函数指针的问题
pointer overflowpython 如何查找数值并判断是否空
a question about bitwise operation再请教一个c++的简单问题(enumerated constant)
how to initialize this struct.C 中的typedef 一问
相关话题的讨论汇总
话题: overflow话题: detect话题: int32话题: bit话题: 64