Author Topic: Use of namespace forces lower case  (Read 3436 times)

outsider

  • Community Member
  • Posts: 64
  • Hero Points: 1
Use of namespace forces lower case
« on: August 04, 2011, 02:16:58 pm »
Hi guys,

I'm curious. Is there a compelling reason why function names must be all lower case if you want to use Slick-C namespaces? At the moment I can't use them since that would mean dropping my camel case programming convention on all my code.

regards

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2920
  • Hero Points: 438
Re: Use of namespace forces lower case
« Reply #1 on: August 16, 2011, 02:38:49 pm »
The conventions are enforced by the compiler because that is Slick-C style.  You can override this using

Code: [Select]
#pragma option(strictnames,off)
Just to review:

  • Namespaces are expected to be all lower case, this is borrowed form Java and C++.
  • Functions within namespaces are expected to be lower case, with words connected by underscores.  This is borrowed from traditional C programming conventions, as well as traditional Slick-C conventions.  Couldn't borrow ideas from Java here...
  • Class names are mixed case and should start with an upper case letter.  This is borrowed from Java and C#.
  • Function names within classes are mixed case and should start out with a lower case letter.  Again, borrowed from Java style.
  • Class member variables should start with "m_" and can be mixed case.
  • Static class member variables should start with "s_" and can be mixed case.
  • Constants, such as enumerations, should be all upper case.

The reason for these conventions is to attempt to make new Slick-C code easier to read.  You can look at a variable's name and immediately know that it is a member, even know if it is static.  You can quickly see the difference between a class name, a namespace, and a function name, as well as the difference between a member function and a non-class function.

outsider

  • Community Member
  • Posts: 64
  • Hero Points: 1
Re: Use of namespace forces lower case
« Reply #2 on: August 17, 2011, 02:33:16 pm »
Thanks for the explanation Dennis. That was useful to know.