[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdepimlibs/kioslave/imap4
From:       Marc Mutz <marc () klaralvdalens-datakonsult ! se>
Date:       2008-05-26 5:03:47
Message-ID: 200805260703.52909.marc () klaralvdalens-datakonsult ! se
[Download RAW message or body]

On Sunday 25 May 2008 13:42, Ingo Klöcker wrote:
> On Sunday 25 May 2008, Marc Mutz wrote:
> > On Saturday 24 May 2008 16:15, Ingo Klöcker wrote:
> > > The use of the static keyword is deprecated when declaring objects
> > > in a namespace scope.... - The C++ Standard, ISO/IEC 14882:1998,
> > > section 7.3.1.1 paragraph 2
> >
> > That's one thing I don't agree with in standard C++,
>
> It would help if you'd explain why you do not agree with this. Apart
> from that I think we should stick to the C++ standard even if some of
> us do not agree to certain points in the standard.

Simple. The standard deprecates namespace-level static for use of the 
anonymous namespace. But objects in any namespace, also the anonymous one, 
have _extern_ linkage by default. That's why the anonymous namespace has been 
introduced in the first place: template arguments need to have extern 
linkage, but you still needed something that's translation-unit private.

In the case at hand, the const makes it static indeed, but that is way too 
subtle for my taste, and you really want to minimize the extern symbols. You 
also didn't put them into the anonymous namespace. Plus, in the setting of a 
string, a few lines above, this already fails to work:

- static const char foo[] = "foo"; // foo is static 
+ const char[] = "foo";  // foo is external

So, I recommend making the static explict. There's a reason no compiler I have 
ever used has warned about the deprecatedness of this.

Thanks,
Marc

-- 
Marc Mutz -- marc@klaralvdalens-datakonsult.se, mutz@kde.org
Klarälvdalens Datakonsult AB, Platform-independent software solutions

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic