[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] C++ templates and debugging (limitations) in Linux



Mike Bird wrote:

> 
> Maintaining one copy instead of two is (almost) always a good idea,
> and one of the reasons why templates are so valuable.

Yes, it is. But here there is this other factor of the suitability of
gdb with templates and STL for debugging. I not sure I know the
intricacies involved to weigh the costs. My past experience was not very
positive.

> 
> Start with a working program.  Make a small change.  Fix compilation
> errors.  Test it.  Fix any problems.  Commit to VCS.  Repeat.

Yes, that is what I do already.

> 
> Occasional misbehavior is usually resolved with the assistance of
> "std::cerr << foo;" or a more sophisticated variant.  About the only
> time I use gdb is to find a clue if a bug causes a segfault.

I also ended up printing variables when I tried to use templates a few
years ago. At that time I thought that that was inefficient, having a
lot of print statements, but it was the only way I could actually see
inside a template variable involving STL.


> In your case it may be possible to incrementally convert the code
> for the original datatype to templated code, and then once that is
> done add the second datatype.

Yup, I agree.

> 
> There are more appropriate places than debian-user for C++ questions.

Yes. There is a news group for C++, but the people there are topic
nazis. Anything not strictly related to the standard is promptly
flogged, hanged, skinned and left to dry. :)

My query, however, was related to the behaviour of combination of C++,
templates, STL and gdb.

The proper place for this query would probably be the newsgroup for gdb.
But that is extremely low traffic.

Hence my post here with the OT warning.



-- 

Please reply to this list only. I read this list on its corresponding
newsgroup on gmane.org. Replies sent to my email address are just
filtered to a folder in my mailbox and get periodically deleted without
ever having been read.


Reply to: