Hey!
I was trying to define some variables by reading from an I2C connection when I stumbled accross seomthing strange... Everything was going fine until I tried to define a variable called "B1":
short AC1 = I2C_read(I2C_address, 0xAA, 2);
short AC2 = I2C_read(I2C_address, 0xAC, 2);
short AC3 = I2C_read(I2C_address, 0xAE, 2);
unsigned short AC4 = I2C_read(I2C_address, 0xB0, 2);
unsigned short AC5 = I2C_read(I2C_address, 0xB2, 2);
unsigned short AC6 = I2C_read(I2C_address, 0xB4, 2);
short B1 = I2C_read(I2C_address, 0xB6, 2); //Troublemaker!
short B2 = I2C_read(I2C_address, 0xB8, 2);
short MB = I2C_read(I2C_address, 0xBa, 2);
short MC = I2C_read(I2C_address, 0xBC, 2);
short MD = I2C_read(I2C_address, 0xBE, 2);
I got the the following error message:
error: expected unqualified-id before numeric constant
#define B1 1
note: in expansion of macro 'B1'
I rewrote the line several times, checked the entire code for errors and was at the edge of punching my laptop when I got the f***ing genius idea to change the name of the variable xD. That fixes it.
So... I wanted to ask why the hell is that?
Thanks for your answers in advance! I am very curious to hear them ![]()