|Linkers, etc, and Object Code Templatey-Type-Things? email@example.com (Simon G Best) (2004-02-01)|
|Re: Linkers, etc, and Object Code Templatey-Type-Things? firstname.lastname@example.org (Paul Pluzhnikov) (2004-02-04)|
|Re: Linkers, etc, and Object Code Templatey-Type-Things? email@example.com (Simon G Best) (2004-02-08)|
|Re: Linkers, etc, and Object Code Templatey-Type-Things? firstname.lastname@example.org (Chris Dodd) (2004-02-08)|
|From:||Simon G Best <email@example.com>|
|Date:||8 Feb 2004 21:56:00 -0500|
|Posted-Date:||08 Feb 2004 21:56:00 EST|
Paul Pluzhnikov wrote:
> Simon G Best <firstname.lastname@example.org> 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.)
> 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.
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).
Return to the
Search the comp.compilers archives again.