GCC Web サイトとSDCC マニュアル§3.5.7によると、GCC と SDCC の両方で、10 進数の 2 を表す次のようなバイナリ定数を使用できます。0b0010
残念ながら、以下に示すように、スプリントはこれをうまく処理できず、解析エラーが発生するようです。
binaryConstants.c
#include <stdio.h>
int main(){
int one = 0b0001;
int two = 0x2;
int three = 3;
printf("B: %d\nH: %d\nD: %d\n", one, two, three);
return 0;
}
出力
$ splint binaryConstants.c
Splint 3.1.2 --- 19 Oct 2016
binaryConstants.c:3:18: Parse Error. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
$
+gnuextensions で出力
$ splint +gnuextensions binaryConstants.c
Splint 3.1.2 --- 19 Oct 2016
Command Line: Setting +gnuextensions redundant with current value
binaryConstants.c:3:18: Parse Error. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
$
この拡張機能を C に許可するフラグはありますか?