C++ templates and overloading

Ugo <dallago@sci.uniud.it>
1 May 2000 13:20:26 -0400

          From comp.compilers

Related articles
C++ templates and overloading dallago@sci.uniud.it (Ugo) (2000-05-01)
Re: C++ templates and overloading bobduff@world.std.com (Robert A Duff) (2000-05-04)
Re: C++ templates and overloading rkrayhawk@aol.com (2000-05-08)
| List of all articles for this month |
From: Ugo <dallago@sci.uniud.it>
Newsgroups: comp.compilers
Date: 1 May 2000 13:20:26 -0400
Organization: NETTuno
Keywords: C++, question, comment

I'm designing a compiler for a proper subset of C++ which includes
- function templates
- overloading of functions
I'm looking for some resources which talks about this problem, i.e.
polymorphism/overloading in IMPERATIVE languages.


Ugo
[I talk a little bit about overloading in "Linkers and Loaders".
Basically, in an overloaded function the types of the arguments and
possibly of the result become part of the true name of the function.
C++ compilers "mangle" the type info into a long text name passed to
the linker. Templates are basically macros, you macro expand them
when you come across an instance. The tricky part is garbage
collecting all of the redundant expanded copies in separately compiled
modules, or arranging not to expand redundantly in the first place.
-John]


Post a followup to this message

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