On Sat, Oct 3, 2009 at 4:25 PM, Peter Kasting <pkast...@google.com> wrote:

> On Sat, Oct 3, 2009 at 11:59 AM, Antoine Labour <pi...@google.com> wrote:
>
>> On Sat, Oct 3, 2009 at 11:09 AM, Dan Kegel <d...@kegel.com> wrote:
>>
>>>
>>> On Sat, Oct 3, 2009 at 11:07 AM, Dan Kegel <d...@kegel.com> 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.
>>
>
> You're missing the point.
>

I don't think I am.
I'm just trying to help... I've encountered this situation many times, with
the same exact behavior, I'm trying to tell you all I know about it,
teaching you how to fish. But maybe I don't express myself clearly.


>  The pre-existing code already had the existing declarations and usage for
> this variable.  I didn't touch that at all.  I added a DCHECK that referred
> to it in a function that already referred to it, and things broke.  I
> commented out the DCHECK and left all the other references and things worked
> again.  This puzzles me.
>

Like I said "The compiler may be able to get away with things if it doesn't
need the actual storage for the value" which explains why the previous code
didn't have the issue - it was just using the value, not the storage. As
Jacob points out, the implementation of DCHECK_NE needs the storage. The
storage declaration is missing, or at least isn't in
blocked_popup_container.cc where it belongs. Beware of simply adding it
without an ifdef though, because in my experience MVSC doesn't like it.

Antoine


>
> PK
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to