Re: post C++ template/inlining resolution

comeau@panix.com (Greg Comeau)
5 Jun 2003 23:09:25 -0400

          From comp.compilers

Related articles
post C++ template/inlining resolution simon_newsgroup@mookstar.co.uk (Simon) (2003-05-24)
Re: post C++ template/inlining resolution idbaxter@semdesigns.com (Ira Baxter) (2003-05-29)
Re: post C++ template/inlining resolution sbeasley@cs.uic.edu (2003-06-03)
Re: post C++ template/inlining resolution comeau@panix.com (2003-06-05)
Re: post C++ template/inlining resolution comeau@panix.com (2003-06-05)
| List of all articles for this month |

From: comeau@panix.com (Greg Comeau)
Newsgroups: comp.compilers,comp.lang.c++
Date: 5 Jun 2003 23:09:25 -0400
Organization: Comeau Computing; http://www.comeaucomputing.com
References: 03-05-174 03-06-009
Keywords: C++
Posted-Date: 05 Jun 2003 23:09:25 EDT

Shane Beasley <sbeasley@cs.uic.edu> wrote:
>"Simon" <simon_newsgroup@mookstar.co.uk> wrote
>> I would like somehow to be able to define a set of C++ template types
>> (including inline methods that are fairly simple), and pass it through
>> something to get out an intermediate version (in C or some
>> representation that is vaguely human readable) so I can see what it
>> has resolved to and what the compiler has to play with.
>
>As I understand it, the Comeau compiler (www.comeaucomputing.com)
>compiles to an intermediate C form, which you would normally feed to a
>C compiler to produce an executable. However, that means that it
>should be possible to stop before the final step and get a peek at
>what the C code looks like. Unfortunately, since C doesn't support
>overloading, templates, etc., the names will probably all look quite
>weird. Also, since it *is* a compiler, it might optimize the C output
>such that it really has nothing much to do with the original C++
>source aside from that they both behave the same way.


Comeau does generate C, but it's an artifact of translation, and
normally not an option to get the C. Even if not, I'm unclear how it
addresses the original question. The things is that all template are
not necessarily instantiation (by a translation unit, or at all) and
further more, things such as default argument to functions may
implictly add overloads, etc, and that would not be apparent in any
intermediate form, since said things may not be emitted. I agree with
the OP that sometimes trying to know which functions were called it
tricky, but this does not necessarily let one see the candidates, etc.


--
Greg Comeau/ 4.3.0.1: FULL CORE LANGUAGE, INCLUDING TC1
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.