Drawbacks of using declarations/namespace aliases
Stephan Bergmann
sbergman at redhat.com
Wed Dec 12 08:44:56 PST 2012
On 12/12/2012 03:22 PM, Lubos Lunak wrote:
> On Tuesday 11 of December 2012, Stephan Bergmann wrote:
>>> commit 3e64874e7cd234ff563ac11450cfb2b6e2db4bf6
>>> Author: Radu Ioan <ioan.radu.g at gmail.com>
>>> --- a/configmgr/source/access.hxx
>>> +++ b/configmgr/source/access.hxx
>>> @@ -82,7 +82,6 @@ namespace com { namespace sun { namespace star {
>>> }
>>> namespace util { struct ElementChange; }
>>> } } }
>>> -namespace rtl { class OUString; }
>>
>> Changes like this are, strictly speaking, unsound. They rely on at
>> least one of the included headers happening to in turn include
>> rtl/ustring.hxx.
>
> Which, practically speaking, is pretty much guaranteed to happen for
> OUString.
>
>> The underlying intransparency wrt forward declarations is IMO a
>> fundamental drawback of the recent efforts of beautification via using
>> declarations or namespace aliases, for rtl and com::sun::star.
>
> I don't understand what fundamental drawback you mean.
The drawback that you must either break transparency when using forward
declarations (by explicitly mentioning "namespace rtl { ... }" resp.
"namespace com { namespace sun { namespace star { ... } } }") or use
#includes instead of forward declarations (which increases dependencies
and thus needles recompilations; arguably not much of an issue for the
rtl::OUString etc. case, but potentially an issue for the com::sun::star
case).
Stephan
More information about the LibreOffice
mailing list