很久,不会太久 [英] long, not too long
问题描述
在Visual Studio 2003中,当我调试C#程序时,我发现:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
怎么来的?一个长型不能处理300L * 10000000l,结果太大了
对于长型很大?
谢谢!
Ryan
Ryan Liu< ad ******** @ online.sh.cn>写道:在Visual Studio 2003中,当我调试C#程序时,我发现:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
怎么来的? long类型不能处理300L * 10000000l,结果对于长类型来说太大了?
这是调试器问题,那是'所有。它在普通代码中工作正常。
-
Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet
如果回复小组,请不要给我发邮件
我想不是这样。当我的代码无效时我发现了这个问题,然后
我开始调试并发现这个问题。
问候,
Jon Skeet [C#MVP]" < SK *** @ pobox.com> ????
新闻:MP ************************ @ msnews.microsoft.c om ... < blockquote class =post_quotes> Ryan Liu< ad ******** @ online.sh.cn>写道:在Visual Studio 2003中,当我调试C#程序时,我发现:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
怎么来的? long类型无法处理300L * 10000000l,结果是
对于long类型来说太大了?
这是一个调试器问题,就是这样。它在普通代码中工作正常。
- Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet
如果回复该群组,请不要给我发邮件
" Ryan Liu" <广告******** @ online.sh.cn>在留言新闻中写道:%2 *************** @ TK2MSFTNGP12.phx.gbl ...我想不太可能。当我的代码不起作用时,我发现了这个问题,然后我开始调试并发现这个问题。
你有机会把它塞进一个int而不是很长的吗?
为什么你不发布有问题的代码。
比尔
Jon Skeet [C#MVP]" < SK *** @ pobox.com> ????
新闻:MP ************************ @ msnews.microsoft.c om ...Ryan Liu< ad ******** @ online.sh.cn>写道:>在Visual Studio 2003中,当我调试C#程序时,我发现:
>
> 300L * 10000000l -1294967296 int
> 210L * 10000000L 2100000000 int
>
>
>怎么会? long类型不能处理300L * 10000000l,结果太>很长的类型?
这是一个调试器问题,就是这样。它在普通代码中工作正常。
- Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet
如果回复该群组,请不要给我发邮件
In Visual Studio 2003, when i debug a C# program, I found:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
How come? a long type can not handle 300L * 10000000l, the result is too
big for long type?
Thanks!
Ryan
Ryan Liu <ad********@online.sh.cn> wrote:In Visual Studio 2003, when i debug a C# program, I found:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
How come? a long type can not handle 300L * 10000000l, the result is too
big for long type?
It''s a debugger issue, that''s all. It works fine in normal code.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
I guess not quite so. I found this problem when my code does not work, then
I begin to debug and find this issue.
Regards,
"Jon Skeet [C# MVP]" <sk***@pobox.com> ????
news:MP************************@msnews.microsoft.c om...Ryan Liu <ad********@online.sh.cn> wrote:In Visual Studio 2003, when i debug a C# program, I found:
300L * 10000000l -1294967296 int
210L * 10000000L 2100000000 int
How come? a long type can not handle 300L * 10000000l, the result is too big for long type?
It''s a debugger issue, that''s all. It works fine in normal code.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
"Ryan Liu" <ad********@online.sh.cn> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl...I guess not quite so. I found this problem when my code does not work, then
I begin to debug and find this issue.
Are you by any chance stuffing it into an int instead of a long?
Why don''t you post the offending code.
Bill
"Jon Skeet [C# MVP]" <sk***@pobox.com> ????
news:MP************************@msnews.microsoft.c om...Ryan Liu <ad********@online.sh.cn> wrote:> In Visual Studio 2003, when i debug a C# program, I found:
>
> 300L * 10000000l -1294967296 int
> 210L * 10000000L 2100000000 int
>
>
> How come? a long type can not handle 300L * 10000000l, the result is too > big for long type?
It''s a debugger issue, that''s all. It works fine in normal code.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
这篇关于很久,不会太久的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!