On Sat, Oct 3, 2009 at 11:09 AM, Dan Kegel <[email protected]> wrote:
>
> On Sat, Oct 3, 2009 at 11:07 AM, Dan Kegel <[email protected]> wrote:
> >> "undefined reference to
> >> BlockedPopupContainer::kImpossibleNumberOfPopups"
>
> Aha. It's a bug in our code. chrome/browser/blocked_popup_container.cc
> needs to follow through and actually declare storage for that variable.
>
MSVC and GCC differ regarding the C++ spec for when you define a static
const in a class.
The spec says you need to provide storage for it.
If you write:
// a.h
class A {
public:
static const int kValue = 314;
};
Then you need to declare storage for it. Only once obviously, so you need it
in a .cc:
// a.cc
#include "a.h"
const int A::kValue;
The compiler may be able to get away with things if it doesn't need the
actual storage for the value (e.g. taking the address), but the spec says
you need to provide storage. GCC works like that. In my experience, MSVC (at
least 8.0) doesn't and barfs when you do declare storage.
Antoine
--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected]
View archives, change email options, or unsubscribe:
http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---