|
 |
Fredrik Eriksson wrote:
> On Sat, 10 May 2008 22:05:53 +0200, Darren New <dne### [at] san rr com> wrote:
>> OK. So the linker is doing duplicate-code removal. It also would seem
>> to assume that all your object code is compiled with the same template
>> source code? Or does it actually look at the object code to make sure
>> it's the same?
>
> It must be the same, or the program is ill-formed.
Um, OK. But that's unenforcable, right? At least in C++?
>> I.e., if I compile A.cpp that includes T.chh to instantiate
>> xyz:vector<long>, and then I edit T.chh and then compile B.cpp that
>> instantiates xyz:vector<long> but that now generated different code,
>> does the linker carry around both versions of the object code?
>
> If you change T.chh, then A.cpp - and any other source file that
> includes T.chh - must be recompiled.
And this is why Java doesn't do templates. You may not have the source
code for A.cpp.
It seems there are two kinds of languages out there: ones where the
program is monolithic and if you don't have all the sources, you can't
really use the object code effectively, and ones that are particularly
designed to avoid the problems that the first group encounter. :-)
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |