[Development] Can we remove recommendation against unnamed namespaces from Qt coding conventions?
Mathias Hasselmann
mathias at taschenorakel.de
Wed Feb 21 18:19:19 CET 2024
Am 21.02.2024 um 17:36 schrieb Thiago Macieira:
> On Wednesday, 21 February 2024 08:26:52 PST Jøger Hansegård via Development
> wrote:
>> Our Qt coding conventions (https://wiki.qt.io/Coding_Conventions) has a
>> statement on the use of unnamed (anonymous) namespaces. As far as I
>> understand, this statement is now outdated. Can we delete this statement
>> and lean on Cpp Core Guidelines Cpp Core Guidelines SF.22 instead
>> https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-unnamed2?
>> Or do we need a Qt specific guideline on this topic?
> There doesn't seem to be a semantic difference. Are you proposing we simply
> replace our wording to point to SF22 or am I missing something?
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."
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.
Ciao
Mathias
More information about the Development
mailing list