By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,837 Members | 1,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,837 IT Pros & Developers. It's quick & easy.

any tool for template debugging ?

P: n/a
Hi,
Is there any tool for template debugging, during compilation process
? Just like gdb or visual studio debugger do it during program
execution, a step by step debug for the program,
I am looking for something which will do the process during
compilation and show what is getting substituted for which call.
Otherwise sometimes, compilation fails saying some value_type can't be
substituted by value_type& and etc inside a template call, but it never
reports who calls it, and in turn all of the steps the compiler follow
to substitute it.
Thus I want to get through the template substitution states that the
compiler uses , and the type parameters that it substitutes, and the
exact specialization that it makes, which will give a justification of
the compiler error that it generates, rather than at run time

thanks
abir

Nov 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

toton wrote:
Hi,
Is there any tool for template debugging, during compilation process
? Just like gdb or visual studio debugger do it during program
execution, a step by step debug for the program,
I am looking for something which will do the process during
compilation and show what is getting substituted for which call.
Otherwise sometimes, compilation fails saying some value_type can't be
substituted by value_type& and etc inside a template call, but it never
reports who calls it, and in turn all of the steps the compiler follow
to substitute it.
Thus I want to get through the template substitution states that the
compiler uses , and the type parameters that it substitutes, and the
exact specialization that it makes, which will give a justification of
the compiler error that it generates, rather than at run time
This is a major problem in C++. The 'Big Idea' to attempt to do
something about the problem is Concepts:

http://www.generic-programming.org/l...es/conceptcpp/

The idea is that instead of using 'raw' template parameters for a
function or class template, that you specify the allowable types for
the template parameter by only allowing types that conform to a
Concept. When you invoke the function on a particular type the
compiler checks whether the type conforms to the Concept and if not
should in theory give you a much more precise error message as to what
the problem is, and point you at the place where the problem is.

There is a downloadable compiler based on gcc which you can use to test
out how this scheme might look:

http://www.generic-programming.org/software/ConceptGCC/

It isnt finished and is far from perfect but is well worth trying out.
There is a good chance Concepts will become part of C++, but currently
the scheme needs lots more user feedback to improve it.

FWIW Here is my ConceptGCC installation for Windows guide:

You need to have Cygwin installed:

http://www.cygwin.com/

Download the ConceptGCC compiler:

http://www.generic-programming.org/s...C/download.php

Assuming cygwin is installed correctly you can unzip the download
using:

'tar -xvjf conceptgcc-VERSION-cygwin.tar.bz2

Move the resulting 'opt' directory to your Cygwin installation. In my
case
C:/Cygwin

So in my case the result is C:/Cygwin/opt

Head for Start>Control Panel.
Head for System>Advanced>Environment Variables.
Find 'Path' environment variable
Add The ConceptGcc bin directory e.g
PREVIOUS_Stuff;C:/Cygwin/opt/conceptgcc-VERSION/bin
Now check it works. Open a command prompt. (If you have Cygwin
correctly
installed you shouldnt need to be in Cygwin shell)

type conceptg++.

If all is working ok you should get:

C:\my_current_dir>conceptg++
conceptg++: no input files

C:\my_current_dir>

You can invoke the compiler from a command prompt in your current
directory by:
// (compile followed by link)

conceptg++ -c test.cpp
conceptg++ -o testprog.exe test.o

Next.. Head for the tutorial:

http://www.generic-programming.org/l...tcpp/tutorial/

regards
Andy Little

Nov 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.