다음을 통해 공유


.NET Is NOT Magic But It Is Darn Close - Integer Overflows

Integer overflows happen when an operation is performed on an numeric type that causes it to go over its max value or below its min value.  Integer oveflows can sometimes lead to security exploits when not taken care of properly.  .NET doesn't do any kind of magic to make this problem go away but it does try to help the developers.  When a integer overflow happens in .NET will raise an OverflowException, except when unchecked is used.  This is actually good because it prevents your program from using the overflowed value to do something like index into an array or allocate a buffer of the wrong size which are common problems in C++.

Comments

  • Anonymous
    March 24, 2008
    .NET gets cooler by the day doesn't it ^_^