Re: Linkers, etc, and Object Code Templatey-Type-Things?

Simon G Best <s.g.best@btopenworld.com>
8 Feb 2004 21:56:00 -0500

          From comp.compilers

Related articles
Linkers, etc, and Object Code Templatey-Type-Things? s.g.best@btopenworld.com (Simon G Best) (2004-02-01)
Re: Linkers, etc, and Object Code Templatey-Type-Things? ppluzhnikov@charter.net (Paul Pluzhnikov) (2004-02-04)
Re: Linkers, etc, and Object Code Templatey-Type-Things? s.g.best@btopenworld.com (Simon G Best) (2004-02-08)
Re: Linkers, etc, and Object Code Templatey-Type-Things? cdodd@acm.org (Chris Dodd) (2004-02-08)
| List of all articles for this month |

From: Simon G Best <s.g.best@btopenworld.com>
Newsgroups: comp.compilers
Date: 8 Feb 2004 21:56:00 -0500
Organization: Very little.
References: 04-02-012 04-02-043
Keywords: linker
Posted-Date: 08 Feb 2004 21:56:00 EST

Paul Pluzhnikov wrote:
> Simon G Best <s.g.best@btopenworld.com> writes:
>
>>Do such linkers / object file formats exist?
>
> They don't, and for C++ they are impossible (I think).


That must be wrong (the latter part). A 'compiler' that compiles from
C++ source code to C++ source code, followed by a 'linker' that not
only links object code, but also compiles C++ source code into object
code, would prove that such linkers /can/ exist. (Whether or not it
would make practical sense to do it like that is another matter.)


> Consider:
>
> template <typename T>
> void assign(const T &rhs)
> {
> this->someField = rhs;
> }


Which is a /definition/.


> What kind of object code can compiler generate here?
>
> Well, it depends on what 'T' is: for an 'int', a 'double', a class
> with 'operator=', and a class without 'op=' but containing instance
> variables with 'op=', compiler will have to generate *very* different
> object code.
>
> Cheers,


Now you're on about /instantiations/.


In the /definition/, "T" isn't anything but a formal parameter of the
template. It's not int, double, a class, or any other actual parameter.


What I was asking about was /linkers/ that are capable of instantiating
actual instances (with actual parameters) from a compiled definition
(with formal parameters).


Simon


Post a followup to this message

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