컴파일러 경고(수준 2) CS0652

업데이트: 2007년 11월

오류 메시지

정수 계열 상수와 비교하는 것은 의미가 없습니다. 상수가 'type' 형식의 범위를 벗어났습니다.
Comparison to integral constant is useless; the constant is outside the range of type 'type'

컴파일러에서 변수의 범위를 벗어난 상수와 변수 간의 비교를 발견했습니다.

다음 샘플에서는 CS0652 오류가 발생하는 경우를 보여 줍니다.

// CS0652.cs
// compile with: /W:2
public class Class1
{
   private static byte i = 0;
   public static void Main()
   {
      short j = 256;
      if (i == 256)   // CS0652, 256 is out of range for byte
         i = 0;
   }
}