struct dive_table dive_table

Linus Torvalds torvalds at linux-foundation.org
Wed Apr 17 12:49:26 PDT 2013


On Wed, Apr 17, 2013 at 12:22 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Christ, I thought C++ development environments would be stable by now.
> Apparently they aren't.

Actually, my bad. It's not the development tools, it's the f*cking
language. It's broken.

In C++, you can do

  struct x {
    ...
  };

and it automatically makes a plain "x" by a type, without the
"struct". So this is legal C++:

  struct x { int a; };
  x x;

and declares the variable 'x' using the type 'x', because of this.
Except it only does that if there isn't some other symbol of that name
in scope, so it's kind of a "weak type" that randomly works or not
depending on random other non-local things.

Yeah, that's good language design. How are the C++ fanboys making
excuses for *this* particular braindamage?

So when gdb sees 'x', it now doesn't know if it's a type or a
variable, because of this "enhancement" that C++ did to the namespace
rules.

This is exactly the kind of idiotic fundamental mistake that I so hate
C++ for. A "better" typesystem/syntax that really isn't, and really
subtly different semantics.

It's still technically a gdb misfeature/bug, though. If gdb is
supposed to debug C++, then it should damn well know about the
ambiguities and know how to parse C++. But I can't personally blame
gdb any more after having figured out where the bug comes from. I
blame Bjarne Stroustrup.

               Linus


More information about the subsurface mailing list