小编Sle*_*her的帖子

C# ulong 上溢/下溢以某种方式允许

我对ulong类型的行为有点困惑。我理解它是一个用于正数64 位整数(最大值 18,446,744,073,709,551,615)。我刚开始使用它是因为我需要非常大的正数,但是在潜在的负数周围有一些我不明白的奇怪行为。

ulong big = 1000000;    //Perfectly legal

ulong negative = -1;    //"Constant value "-1" cannot be converted to a ulong" Makes sense


//Attempt to sneak around the -1 as a constant compile-time error
int negativeInt = -1;
ulong negativeUlongFail = negativeInt;    //"Cannot implicitly convert 'int' to 'ulong'.
                                 //An explicit conversion exists (are you missing a cast?)"
//So I add casting
ulong negativeUlong = (ulong)negativeInt;    //But this yields 18446744073709551615

//Try and get a …
Run Code Online (Sandbox Code Playgroud)

c# integer overflow underflow ulong

5
推荐指数
1
解决办法
1108
查看次数

GitHub 当有人关注我时收到电子邮件

也许我错过了一些非常明显的东西,但我进入了我的通知设置,找不到任何关于当人们关注你时收到电子邮件的信息。我可以随时转到我的个人资料上的“关注者”选项卡,查看当前关注我的人,但我想获取更新。

我发现有新人关注我的唯一方法是无意中访问普通的GitHub.com并浏览我的活动。

git email notifications github

5
推荐指数
1
解决办法
1846
查看次数

标签 统计

c# ×1

email ×1

git ×1

github ×1

integer ×1

notifications ×1

overflow ×1

ulong ×1

underflow ×1