https://bugs.freedesktop.org/show_bug.cgi?id=82577
--- Comment #4 from Björn Michaelsen <bjoern.michaelsen@canonical.com> ---
(In reply to comment #3)
One thing that we need consensus on is whether to use a "real" C++ namespace
or a "C-style" one, i.e. just prefixing the conlicting LibreOffice type
names with some short string, like "Vcl".
IHMO C++ namespaces as its better for tooling, e.g. doxygen:
http://docs.libreoffice.org/sw/html/namespaces.html
I guess the C++ namespace would be better from a C++ orthodoxy point of
view, but what should the namespace be? "vcl::" ? "org::libreoffice::vcl::"
(brrr)?
No, not a java-like "lets prefix my full home address" thing. We already have
"com::sun::star::" as our public API. There were discussions of aliasing that
as "libreoffice::" (llunak wanted something like that IIRC).
For our private/internal API, having "vcl::Foo" should already be less risky
than "VclFoo" -- and in the long term, if needed, we could move "vcl::" to
something-like "libreoffice::private::vcl::" or "libreoffice::internal::vcl::",
when there are conflicts. It will be a lot easier to move a namespace than to
rename hundreds of classes.
In any case, we *don't* want to repeat the current disaster of
inconsistent "using" declaration, varying from one source file to another.
IMHO that is mostly a symptom of having unmanageable 10KLOC or more per source
file, so that its not easy to see what a using (or #include for the matter) is
for and thus they are rarely touched and just grow.
Would using a C++ namespace have the benefit that it would be enough to just
add a "using namespace vcl" (or whatever) in some header, and only those few
source files that actually refer to the identically-named X11 types would
need to add a :: prefix to those?
using in header files is so harmful that most coding styles disencourage it,
e.g. Sutter/Alexandrescus "C++ Coding Standards" rule 59: "Don’t write
namespace usings in a header file or before an #include."
http://stackoverflow.com/questions/5849457/using-namespace-in-c-headers
Anyway, this is more of a discussion for the mailing list or the ESC, lets take
it there if there is further need.
--
You are receiving this mail because:
You are on the CC list for the bug.
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.