|
|
In article <chr### [at] netplexaussieorg> ,
Christopher James Huff <chr### [at] maccom> wrote:
> I'm not sure quite what you mean...though if no compilers support it
> yet, I guess it doesn't really matter.
Imagine
list<MyClassA> lista;
list<MyClassB> listb;
where MyClassA and MyClassB have no common base.
Compilers right now just copy the code for all functions. Later the linker
will only strip unused functions, but that is all.
However, if the compiler collects the requirements (the misc operator member
functions, i.e. constructors, destructors, comparison operators) in advance,
it could exploit this advance knowledge. For example then the function to
insert an element would be the same, it would only have to know what class
the user wishes to insert and then call the constructor of that class
dynamically.
To understand why this isn't possible without "export" is that the compiler
only looks at one translation unit (a source file) at a time. The "export"
keyword basically tells the compiler that there is shared code. Of course,
onyl could simply parse all translation units and treat them as one, but
doing so would require so much memory for a mid-sized project, we cannot
dream about for decades to come! *
Thorsten
* Just imagine that with optimizations, CW needs over 100 MB of memory for
some source files in POV-Ray. Now consider there are 100 of those files,
and you fill 5-10 GB quickly! Of course, POV-Ray can be considered a
"small" project compared to most commercial applications these days...
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|