[Bug 82577] get rid of prex.h / postx.h wrapper headers
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Aug 18 02:04:29 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=82577
--- Comment #4 from Björn Michaelsen <bjoern.michaelsen at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140818/448c70cd/attachment.html>
More information about the LibreOffice
mailing list