> [It's annoying to do]
>
>  b (anonymous namespace)::foo
>
> (If there's a less verbose way of doing this, please let me know.)

Does that even work if you're not inside the file which contains
foo()?  I'd be impressed...

I almost always do

  (gdb) b Foo.cpp:123

because that's the only thing which works consistently for me.

If we're suggesting our namespaces should be designed for
gdb-friendliness, then let's note that

  (gdb) b mozilla::dom::ipc::MessageManagerCallback::foo

is just as bad as "(anonymous namespace)".

Given that we want anonymous namespaces to restrict the visibility of
types, I don't think it's reasonable to restrict their usage only to
those cases when you can't use static.

If it's a pain to use anonymous namespaces in your debugger, I'd say
we should fix the debugger.  I bet the gdb folks would take a patch
for something like "b (anon)::foo" or for tab-completing "(anonymous
namespace)", or something like that.

>It also obfuscates the visibility of the identifier,

That's a problem with namespaces in general.  Do you have a reason we
should use namespaces but shouldn't use anonymous ones (except where
we have to), or is the argument for limiting the use of all
namespaces?

-Justin

On Fri, Nov 2, 2012 at 4:32 PM, Nicholas Nethercote
<n.netherc...@gmail.com> wrote:
> On Sat, Nov 3, 2012 at 6:59 AM, Jason Duell <jduell.mcb...@gmail.com> wrote:
>> I see an increasing number of patches using anonymous namespaces instead of
>> 'static'.   This is debugger unfriendly
>
> It also obfuscates the visibility of the identifier, because the
> |namespace {| is often far from the identifier.  This is particularly
> a problem when reading patches -- you have to consult the original
> file to really understand what's going on.
>
> Nick
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to