ふぢのLINT講座


constant truncated by assignment
(値の代入時に値の切り詰めが発生した)

以下のエラーを検出することが出来ます。

(実例1)
#include <stdio.h>

main()
{
  short abc;
  
  abc = 0xffff;
  
  (void)printf( "abc = %d\n", abc );
}






変数“abc”に設定できるのは、-32768〜32767の間。0xffff(65536)は設定できない。もし設定したければ、変数”abc”をunsigned shortにする。





もどる