PDA

View Full Version : SLOT naming rules



George Neil
11th November 2010, 08:16
When i try to use a SLOT function name starting with an integer [like void 3DupdateStatus(){} ], i am getting compile errors like

Error 1 error C2059: syntax error : 'bad suffix on number'
Error 2 error C2059: syntax error : 'constant'
Error 3 error C2238: unexpected token(s) preceding ';'

Is there any SLOT naming rules which don't allow integers at the beginning of SLOT function names ?

Zlatomir
11th November 2010, 08:57
In Visual C++ you can't write a function name starting with a digit, i'm not sure if this is standard C++ :o, or only in Visual C++, so slots being member functions that rule still apply.

tbscope
11th November 2010, 09:08
It's a c/c++ rule. You can't use a function or variable name beginning with a number.
Because you're able to use hexadecimal numbers in C++ (for example), the compiler can not know the difference between a name and a value. Is "0xAB" a name or a value?

Edit: of course, the rules could be made more relaxed. But that's what it is now.