0

I'm about to write a C++ library that is to be used by a Windows application as well as on Symbian. Linux is not a current requirement but should generally be possible, too.
For this reason I would like to use the STL/Boost naming conventions instead of Symbian's, which I think, are hard to get used to.
This seems to already present a problem, when compiling the code with Carbide.c++ as it enforces the Symbian naming convention.

How can I use "normal" names and still be Symbian compatible? I first thought about conditionally re-#define-ing class names for the Symbian platform but I fear, that this will lead to confusion.

Could there occur other problems by not complying with Symbian's naming convention?

foraidt
  • 5,519
  • 5
  • 52
  • 80
  • 1
    Which conventions is it enforcing? If it's forcing class names to begin with C, then that's fairly bogus and if you can't turn it off, don't use Carbide. You'll have to write your own mmp files, but it's not the end of the world. If it's just flagging leaving functions, then that's right, your cross-platform client API shouldn't be leaving, should it? Or is it going to be documented, "this function leaves on Symbian but throws an exception on Windows"? I think that's a bad idea: just offer two interfaces to your library if the behaviour is different. – Steve Jessop Aug 05 '09 at 14:09
  • Actually I don't know which conventions it enforces. My colleague, that would do the Symbian specific stuff, told me we'd better comply to the convention or else strange things may happen. He's not a Symbian expert either. We're just trying to re-use code that already works on Symbian and make it usable somewhere else, too. – foraidt Aug 05 '09 at 14:27

1 Answers1

4

Coding conventions are not strict. They are there to make understanding code easier for us humans. If you're writing a multi-platform library, feel free to use whatever convention you are comfortable with.

Of course, your library probably needs to interface with the underlying operating system in some ways. With the help of Open C/C++ libraries, you can do many things without needing to use native Symbian C++ APIs and their naming conventions.

In Carbide.c++ you may want to disable CodeScanner static analysis as it is really only useful to code written in native Symbian C++.

So in summary, the problems are as follows:

  • People coming from native Symbian C++ background are not immediately familiar with your conventions
  • Using native Symbian C++ APIs can expose some platform-specific peculiarities (exceptions vs. leaves, trap harnesses, active schedulers etc.)
  • Symbian-specific static analyzers such as CodeScanner assume Symbian C++ code style and may generate errors/warnings you really don't need to care about
laalto
  • 150,114
  • 66
  • 286
  • 303