[Development] C++ namespace recommendation for public APIs
henry.haverinen at nokia.com
henry.haverinen at nokia.com
Tue Mar 13 14:45:07 CET 2012
Hi all,
We've had a guideline about C++ namespace in the Qt Project wiki at
http://bit.ly/xrfXOx, saying: "For Qt Add-On Modules, a C++ namespace is
required to avoid class naming clashes with other modules in the public
API. For the "Qt Foo" module the namespace would be QtFoo. Exception: in
order to keep source compatibility with Qt 4, no namespace is required for
former Qt 4 modules."
This rule is a bit strict, and it is problematic if/when we want to move
modules between the categories.
So I asked Lars:
>>
>>Or should this be a softer recommendation, for example: "Qt modules are
>>recommended to wrap their public API in a C++ namespace, to avoid clashes
>>in symbol naming with other Qt libraries. The C++ namespace is the module
>>name in camel-case format, for example: QtFeedback, QtJsonDb, QtContacts
>>and QtBluetooth. Namespaces are especially recommended for Qt Add-On
>>modules. However, former Qt 4 modules do not use a namespace for source
>>compatibility reasons."
Lars wrote:
>
>Yes, this sounds good IMO.
...so I updated the wiki guideline to be that recommendation instead of
the previous harder requirement for Qt Add-Ons.
Comments? Do we need more edits?
Best regards,
Henry
More information about the Development
mailing list