Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


On 06/18/2015 09:32 AM, Miklos Vajna wrote:
One nitpick: please avoid namespace aliases or using statements in
headers[1], currently ~no code does that (com::sun::star -> css is the
only exception, I think), and it helps readability: that way you can
always go to the start of the file and see all of them.

Just mentioning as I guess this affects each class where you add
multi-index support, so it saves time if you get this right from the
very beginning.

[1] https://wiki.openoffice.org/wiki/Writer/Code_Conventions says
"header files, where using-statements are not permitted", AFAIK that's
still true for LO code, too

Beware, though, the differences between

(1) namespace aliases,

  namespace foo = bar::baz;

(2) using declarations,

  using foo::bar;

(3) using directives,

  using namespace foo::bar;

Technically, only (3) is generally problematic in include files (esp. in global scope), as it pollutes the respective scope with a set of names that may change over time, for all compilation units including that file.

(1) and (2) introduce single names into a scope; whether to allow them in include files is more a matter of taste.

(There is no "using-statements" in C++, whatever <https://wiki.openoffice.org/wiki/Writer/Code_Conventions> wants to talk about.)

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.