如何规避 Symbian 命名约定?
我即将编写一个 C++ 库,供 Windows 应用程序以及 Symbian 上的应用程序使用。 Linux 不是当前的要求,但通常也是可能的。
因此,我想使用 STL/Boost 命名约定,而不是 Symbian 的,我认为很难习惯。
当使用 Carbide.c++ 编译代码时,这似乎已经出现了问题,因为它强制执行 Symbian 命名约定。
如何使用“正常”名称并仍然兼容 Symbian? 我首先考虑有条件地重新定义 Symbian 平台的类名,但我担心这会导致混乱。
不遵守Symbian的命名约定会不会出现其他问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编码约定并不严格。 它们的存在是为了让我们人类更容易理解代码。 如果您正在编写一个多平台库,请随意使用您喜欢的任何约定。
当然,您的库可能需要以某种方式与底层操作系统进行交互。 借助开放 C/C++ 库,您可以做很多事情无需使用本机 Symbian C++ API 及其命名约定。
在 Carbide.c++ 中,您可能想要禁用 CodeScanner 静态分析,因为它实际上只对用本机 Symbian C++ 编写的代码有用。
总而言之,问题如下:
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: