Results 1 to 3 of 3

Thread: SLOT naming rules

  1. #1
    Join Date
    Jun 2008
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post

    Default SLOT naming rules

    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 ?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: SLOT naming rules

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

  3. The following user says thank you to Zlatomir for this useful post:

    George Neil (12th November 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: SLOT naming rules

    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.

  5. The following user says thank you to tbscope for this useful post:

    George Neil (12th November 2010)

Similar Threads

  1. Naming Convention for QT
    By metdos in forum Qt Programming
    Replies: 4
    Last Post: 20th August 2015, 09:27
  2. Expansion rules for a blank widget
    By dohzer in forum Newbie
    Replies: 4
    Last Post: 12th August 2010, 16:07
  3. Mastering signals; what's your opinion on Delta Object Rules?
    By piotr.dobrogost in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2009, 13:05
  4. Build rules: Please assist
    By locus in forum General Programming
    Replies: 1
    Last Post: 4th April 2007, 07:15
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.