RHEL 5.7 x86_64ボックスでg ++バージョン4.1.2を使用しています。これは、RHEL 6.0 x86_64に付属のg ++バージョン4.4.5でうまくいきます。このコンパイラのエラーは何を意味し、どのように修正しますか?エラー:整数定数の無効な接尾辞 "b11111111111111111111111111111111"
[[email protected] C]$ g++ -Wall -o binary ./binary.cpp
./binary.cpp:2:5: error: invalid suffix "b11111111111111111111111111111111" on integer constant
./binary.cpp:3:5: error: invalid suffix "b11111111111111111111111111111110" on integer constant
./binary.cpp:4:5: error: invalid suffix "b11111111111111111111111111111100" on integer constant
./binary.cpp:5:5: error: invalid suffix "b11111111111111111111111111111000" on integer constant
./binary.cpp:6:5: error: invalid suffix "b11111111111111111111111111110000" on integer constant
./binary.cpp:7:5: error: invalid suffix "b11111111111111111111111111100000" on integer constant
./binary.cpp:8:5: error: invalid suffix "b11111111111111111111111111000000" on integer constant
./binary.cpp:9:5: error: invalid suffix "b11111111111111111111111110000000" on integer constant
./binary.cpp:10:5: error: invalid suffix "b11111111111111111111111100000000" on integer constant
./binary.cpp:11:5: error: invalid suffix "b11111111111111111111111000000000" on integer constant
./binary.cpp:12:5: error: invalid suffix "b11111111111111111111110000000000" on integer constant
./binary.cpp:13:5: error: invalid suffix "b11111111111111111111100000000000" on integer constant
./binary.cpp:14:5: error: invalid suffix "b11111111111111111111000000000000" on integer constant
./binary.cpp:15:5: error: invalid suffix "b11111111111111111110000000000000" on integer constant
./binary.cpp:16:5: error: invalid suffix "b11111111111111111100000000000000" on integer constant
./binary.cpp:17:5: error: invalid suffix "b11111111111111111000000000000000" on integer constant
./binary.cpp:18:5: error: invalid suffix "b11111111111111110000000000000000" on integer constant
./binary.cpp:19:5: error: invalid suffix "b11111111111111100000000000000000" on integer constant
./binary.cpp:20:5: error: invalid suffix "b11111111111111000000000000000000" on integer constant
./binary.cpp:21:5: error: invalid suffix "b11111111111110000000000000000000" on integer constant
./binary.cpp:22:5: error: invalid suffix "b11111111111100000000000000000000" on integer constant
./binary.cpp:23:5: error: invalid suffix "b11111111111000000000000000000000" on integer constant
./binary.cpp:24:5: error: invalid suffix "b11111111110000000000000000000000" on integer constant
./binary.cpp:25:5: error: invalid suffix "b11111111100000000000000000000000" on integer constant
./binary.cpp:26:5: error: invalid suffix "b11111111000000000000000000000000" on integer constant
./binary.cpp:27:5: error: invalid suffix "b11111110000000000000000000000000" on integer constant
./binary.cpp:28:5: error: invalid suffix "b11111100000000000000000000000000" on integer constant
./binary.cpp:29:5: error: invalid suffix "b11111000000000000000000000000000" on integer constant
./binary.cpp:30:5: error: invalid suffix "b11110000000000000000000000000000" on integer constant
./binary.cpp:31:5: error: invalid suffix "b11100000000000000000000000000000" on integer constant
./binary.cpp:32:5: error: invalid suffix "b11000000000000000000000000000000" on integer constant
./binary.cpp:33:5: error: invalid suffix "b10000000000000000000000000000000" on integer constant
コード:
static int s_bitCountMask[32] = {
0b11111111111111111111111111111111,
0b11111111111111111111111111111110,
0b11111111111111111111111111111100,
0b11111111111111111111111111111000,
0b11111111111111111111111111110000,
0b11111111111111111111111111100000,
0b11111111111111111111111111000000,
0b11111111111111111111111110000000,
0b11111111111111111111111100000000,
0b11111111111111111111111000000000,
0b11111111111111111111110000000000,
0b11111111111111111111100000000000,
0b11111111111111111111000000000000,
0b11111111111111111110000000000000,
0b11111111111111111100000000000000,
0b11111111111111111000000000000000,
0b11111111111111110000000000000000,
0b11111111111111100000000000000000,
0b11111111111111000000000000000000,
0b11111111111110000000000000000000,
0b11111111111100000000000000000000,
0b11111111111000000000000000000000,
0b11111111110000000000000000000000,
0b11111111100000000000000000000000,
0b11111111000000000000000000000000,
0b11111110000000000000000000000000,
0b11111100000000000000000000000000,
0b11111000000000000000000000000000,
0b11110000000000000000000000000000,
0b11100000000000000000000000000000,
0b11000000000000000000000000000000,
0b10000000000000000000000000000000,
};
#include <stdio.h>
int main(int argc, char *argv[])
{
for (int i = 0; i < 32; i++) {
printf("%d\n",s_bitCountMask[i]);
}
}
+1はエラーがちょうど素晴らしいように見えるので+1してください。 – slhck
このようなタイトルをクリックできないのはどうですか? – Mysticial
答えはありませんが、実行時に配列を計算する方が簡単でしょうか? –