[Development] Can we remove recommendation against unnamed namespaces from Qt coding conventions?

Thiago Macieira thiago.macieira at intel.com
Wed Feb 21 18:53:56 CET 2024


On Wednesday, 21 February 2024 09:19:19 PST Mathias Hasselmann via Development 
wrote:
> How that?
> 
> https://wiki.qt.io/Coding_Conventions#Things_to_avoid says:
> 
> "Avoid the use of anonymous namespaces in favor of the static keyword if
> possible."

Back in the day, this was a better suggestion. Now, it's equivalent so it's 
distinction without a difference.

> While
> https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-unnamed2
> says:
> 
> "Consider putting every definition in an implementation source file in
> an unnamed namespace [...]"
> 
> Either I am missunderstanding something, or Qt Coding Conventions and
> C++ Core Guidelines strongly disagree on whether to use anonymous
> namespaces.

Fair.

But I disagree with SF22 and will continue to use statics. There's nothing 
wrong with them.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240221/3c1f0a75/attachment-0001.bin>


More information about the Development mailing list