I
Ian Collins
James said:Except g++, of course. And Comeau, and Intel (I think).
Probably every compiler on Unix and Unix like platforms uses the OS's
linker.
James said:Except g++, of course. And Comeau, and Intel (I think).
Because you can emulate export templates to a degree with
manual instantiation.
In other words, in the header file you can simply have the
declaration of the template class or template function (ie.
not its definition), and then in a source file you can
implement the definition and then in that file instantiate it
manually for each type with which the template is being used
in the program.
I have done that in practice and it works.
It's quite simple to do, at least for simple template types.
The above example compiles at least with gcc and Visual C++.
I don't think you understand how export templates work. Export
templates are no different from regular templates.
They are not (and cannot be) compiled to object files prior to
their actual instantiation. They are compiled *after* they
have been instantiated, just like regular templates.
Yes, the linker stage has to call the C++ compiler in order to
instantiate export templates with the proper types, after
which they are compiled more or less like regular templates.
James said:But it doesn't solve the problem. You've shown that in one
simple case it can be made to work. That's not what's required.
It has to work in all legal cases.
Jerry said:[ ... ]
Why do people bother to even mention/talk about such pathetic excuses
for a compiler ?
Producing C as its output doesn't make Comeau any less a compiler
than producing object code would. Your claim only shows that you
don't know what you're talking about.
From a practical viewpoint, its use of C as an intermediate language
isn't normally visible at all. You run the compiler, and you get an
executable file as output.
That's why I asked for examples of export templates which are
difficult for compilers to implement. All you have said is
that export templates are difficult, without giving any actual
examples.
Jerry said:[ ... ]
Why do people bother to even mention/talk about such pathetic excuses
for a compiler ?
Producing C as its output doesn't make Comeau any less a compiler
than producing object code would. Your claim only shows that you
don't know what you're talking about.
From a practical viewpoint, its use of C as an intermediate language
isn't normally visible at all. You run the compiler, and you get an
executable file as output.
Sorry for my ignorance, but how do you debug with such compiler?
ie. they compile C++ to C
because its one way to implement a compiler?
Producing C as its output doesn't make Comeau any less a compiler
than producing object code would. Your claim only shows that you
don't know what you're talking about.From a practical viewpoint, its use of C as an intermediate language
isn't normally visible at all. You run the compiler, and you get an
executable file as output.Not likely -- especially since (as far as I can see) Sun specifically
says their most recent compiler does NOT implement export. See:According to Sun: "This feature is not yet implemented, but the
export keyword is recognized."So, people talk about Comeau and Intel as the only ones that
implement export, because nothing else implements export. They talk
about Comeau, because it's the ONLY one that really supports export.
don't quote .sigs
I well know C++ compilers are actually translators from C++ to
assembly language, but still there is a big difference between a cheap
C++ to C translator and a real C++ compiler. Big difference !
what is this argument by repetition? Are compilers that compile C
significantly cheaper than native code compilers. It wouldn't surprise
me if native code C++ compilers often share a back-end with the
implementor's C compiler. Do gcc write a fresh back end for both C and
C++ every time they port?
This is exactly why such a good-looking, standards-conforming pseudo
"compiler" is not really wide-spread as others, real ones, are,
despite being less conforming and more expensive .
I would like to try Comeau but they have no free version for their
cheap translator, they actually charge money for it !
maybe this "cheap" thing is in your head?
So if I just want to see the export keyword live in action I can only
try the free Linux version of Intel C++ compiler.
er, comeau?
The Intel compiler is also awkward in that it requires Microsoft
Visual C++ or at last some SDK in order to run !
why?
The Linux version is
somewhat better: it requires gcc ...
what? Intel's compiler requires gcc?
Same for a search engine and yet they don't cost money to use.
Also, of course, the semantics of an exported template aren't
the same as those of a template which isn't exported. Many
cases of undefined behavior with todays templates are well
defined if the template is exported.
Could you give an example, please?
It's partly to do with the fact that search engines can make far more
money by selling to advertisers than selling to us - they do get paid
for their work, just (helpfully) not by us.
http://anthonywang.com/2009/07/16/y...7/17/where-does-google-get-97-of-its-revenue/
I guess compiler writers have far less to offer potential advertisers
than search engine companies - the number of people who want to compile
free code on the web is substantially smaller than the number who want
to e.g. find their nearest pizza outlet. Since somebody has to keep the
compiler writers off the street, that therefore ends up being us (for
want of a better alternative).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.