Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > A tool to view instantiated templates?

Reply
Thread Tools

A tool to view instantiated templates?

 
 
Steven T. Hatton
Guest
Posts: n/a
 
      08-19-2004
If I understand correctly, a template is translated into its source
equivalence, either explicitly, or implicitly. It seems to me, a tool that
would show me that intermediate form of the template would be very useful
in understanding what my templates are actually doing. Is there such a
tool?

G++ may support this, but I didn't see a way to do it when I looked in the
documentaton. I'll ask on a gcc newsgroup and see if I can get an answer
about that specific issue.
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      08-19-2004
Steven T. Hatton wrote:
> If I understand correctly, a template is translated into its source
> equivalence, either explicitly, or implicitly. It seems to me, a tool that
> would show me that intermediate form of the template would be very useful
> in understanding what my templates are actually doing. Is there such a
> tool?
>
> G++ may support this, but I didn't see a way to do it when I looked in the
> documentaton. I'll ask on a gcc newsgroup and see if I can get an answer
> about that specific issue.


I don't know of such a tool. But how would it be "very useful"? What
in the template code don't you see that the tool would show you? The
actual types? Write your template so that the type argument is named
as one of the supported types, say 'CHAR' for 'char' or 'INT' for 'int'.
It'll be quite readable (better than 'T'). The actual values? Well,
the same solution could work: name the values _1 and _0 or something
like it. Or do you need to see recursive template expansion to see what
happens when you do

template<int _1> class S { blah S<_1 - 1>; };
template<> class S<0> { blahblah; };

? Well, that's a bit tricky. I, for one, would only use that "template
viewing tool" to see the expanded recursive templates. However, I would
be very surprised if such tool would be provided by a company who doesn't
have a compiler because rules concerning templates are complicated and if
you can get them right, you're more than half-way in writing a compiler.
OTOH, if you have enough people to write a compiler, that's what your
efforts would be concentrated on... IMHO.

V
 
Reply With Quote
 
 
 
 
E. Robert Tisdale
Guest
Posts: n/a
 
      08-19-2004
Steven T. Hatton wrote:

> If I understand correctly, a template is translated into its source
> equivalence, either explicitly, or implicitly. It seems to me that,
> a tool that would show me that intermediate form of the template
> would be very useful in understanding what my templates are actually doing.
> Is there such a tool?
>
> G++ may support this, but I didn't see a way to do it
> when I looked in the documentaton. I'll ask on a gcc newsgroup
> and see if I can get an answer about that specific issue.


C++ template code is more difficult to read, debug and maintain.
I don't know of any tools (g++ or otherwise)
that will help you display the instantiations.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any g++ option to view the instantiated function from a template post compilation Varun Tewari C++ 2 01-27-2013 10:28 AM
Events not firing from dynamically instantiated classes. AndrewMBaldwin@gmail.com ASP .Net 1 09-14-2005 06:17 PM
View instantiated RAM by address in sim dwerdna VHDL 8 03-23-2005 03:53 AM
ASP.NET application freezes when COM object is instantiated Ralf Müller ASP .Net 3 01-19-2005 09:59 AM
How to make a week view and day view calendar just like month view calendar in .NET ? Parthiv Joshi ASP .Net Web Controls 1 07-06-2004 03:15 PM



Advertisments