3 ms·
So we don't really have strong coding standards (kind of tricky when you inherit a 10 million LOC codebase written over ~20 years), we just try to be pragmatic
by grandinj 4y ago
So we don't really have strong coding standards (kind of tricky when you inherit a 10 million LOC codebase written over ~20 years), we just try to be pragmatic and improve the code where we can.
So we have a collection of plugins, see here:
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins https://cgit.freedesktop.org/libreoffice/core/tree/compilerp...
Which verify a variety of things.
We focus on 2 things: finding dodgy code and using APIs correctly. We don't try to modify the C++ language, just restrict accidentally straying into some of the really nasty corners.
But I like to keep an eye on experiments like yours for ideas :-)
e.g.
no c-style casts:
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/cstylecast.cxx https://cgit.freedesktop.org/libreoffice/core/tree/compilerp...
use the comma-operator sparingly:
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/commaoperator.cxx https://cgit.freedesktop.org/libreoffice/core/tree/compilerp...
is your loop variable really big enough:
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/loopvartoosmall.cxx https://cgit.freedesktop.org/libreoffice/core/tree/compilerp...
calling virtual methods from destructors is dodgy:
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/fragiledestructor.cxx https://cgit.freedesktop.org/libreoffice/core/tree/compilerp...