This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] xfailed tests in gdb.c++/classes.exp


>>>>> "Daniel" == Daniel Jacobowitz <drow at mvista dot com> writes:

 Daniel> On Thu, Feb 27, 2003 at 09:51:06PM -0600, Michael Elizabeth
 Daniel> Chastain wrote:
 dc> 1) GDB prints "class X { public: ... }" when the programmer
 dc> originally wrote "struct X { ... }".
 >> I think this should be a PASS.
 >> 
 dc> 2) GDB prints "class X { private: int x; ... }" when the
 dc> programmer originally wrote "class X { int x; ... }".
 >> I think this should be a PASS.
 >> 
 >> David C formulated this idea as: if the text can be fed back into
 >> a C++ compiler and generate the same results, then it's okay.  By
 >> and large I agree with that.
 >> 
 >> If you look in gnats, you will see users complaining that they
 >> can't print their string variables (because C++ strings are
 >> implemented with layers of templates and derived classes).  They
 >> are complaining that operator overloading doesn't work.  They are
 >> complaining that they have a std::vector<Foo> and they can't even
 >> look inside the damn thing.
 >> 
 >> They aren't complaining that they wrote 'struct X { ... }' but gdb
 >> prints 'class X { public: ... }'.

 Daniel> Sure.  But I suspect 2) represents an actual bug.  Fixing
 Daniel> this is about three lines in c-typeprint.c.  Should we or
 Daniel> shouldn't we?

Why?  In both cases, the source code text and the GDB printout are
equivalent by the C++ rules.  You can replace the one by the other
without any impact on the meaning of the program.

Certainly for those who are only half conversant with C++ type rules,
having "struct foo" replaced by "class foo { public:" may come as a
surprise, but that's a good incentive for them to learn the
language...

	paul



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]