Trouble compiling with binary constants
Posted: Thu Jan 03, 2013 1:06 pm
I'm trying to compile the following in Eclipse (NNDK 2.4 RC2) targeted to a MOD5234:
const UINT8 MapFansToFanSets[] =
{
0b00000000, // 0 fans
0b00000001, // 1 fan
0b00000011, // 2 fans
0b00000111, // 3 fans
0b00001111, // 4 fans
0b00011111, // 5 fans
0b00111111, // 6 fans
0b01111111, // 7 fans
0b11111111 // 8 fans
};
(NB: 'UINT8' is #defined as 'unsigned char'...)
And I get the following errors:
..\env_fans.cpp:22:4: error: invalid suffix "b00000000" on integer constant
..\env_fans.cpp:23:4: error: invalid suffix "b00000001" on integer constant
..\env_fans.cpp:24:4: error: invalid suffix "b00000011" on integer constant
..\env_fans.cpp:25:4: error: invalid suffix "b00000111" on integer constant
..\env_fans.cpp:26:4: error: invalid suffix "b00001111" on integer constant
..\env_fans.cpp:27:4: error: invalid suffix "b00011111" on integer constant
..\env_fans.cpp:28:4: error: invalid suffix "b00111111" on integer constant
..\env_fans.cpp:29:4: error: invalid suffix "b01111111" on integer constant
..\env_fans.cpp:30:4: error: invalid suffix "b11111111" on integer constant
I Googled "gcc binary constants" and it looks like I did it right.
Any suggestions?
Thanx!
Scott
const UINT8 MapFansToFanSets[] =
{
0b00000000, // 0 fans
0b00000001, // 1 fan
0b00000011, // 2 fans
0b00000111, // 3 fans
0b00001111, // 4 fans
0b00011111, // 5 fans
0b00111111, // 6 fans
0b01111111, // 7 fans
0b11111111 // 8 fans
};
(NB: 'UINT8' is #defined as 'unsigned char'...)
And I get the following errors:
..\env_fans.cpp:22:4: error: invalid suffix "b00000000" on integer constant
..\env_fans.cpp:23:4: error: invalid suffix "b00000001" on integer constant
..\env_fans.cpp:24:4: error: invalid suffix "b00000011" on integer constant
..\env_fans.cpp:25:4: error: invalid suffix "b00000111" on integer constant
..\env_fans.cpp:26:4: error: invalid suffix "b00001111" on integer constant
..\env_fans.cpp:27:4: error: invalid suffix "b00011111" on integer constant
..\env_fans.cpp:28:4: error: invalid suffix "b00111111" on integer constant
..\env_fans.cpp:29:4: error: invalid suffix "b01111111" on integer constant
..\env_fans.cpp:30:4: error: invalid suffix "b11111111" on integer constant
I Googled "gcc binary constants" and it looks like I did it right.
Any suggestions?
Thanx!
Scott