Topic: Compiled templates?


Author: Ari.Huttunen@hut.fi (Ari Juhani Huttunen)
Date: 29 Mar 91 13:38:00 GMT
Raw View
Is it possible to distribute compiled templates in binary form, so that
the user can use them as templates, or do you have to supply the source
code for them?

(As I understand it, distribution of compiled libraries is something that
 is required of c++ to be successful.)
--
Ari Huttunen, email: Ari.Huttunen@hut.fi, phone: 90-7285944




Author: hansen@pegasus.att.com (Tony L. Hansen)
Date: 29 Mar 91 18:49:15 GMT
Raw View
< From: Ari.Huttunen@hut.fi (Ari Juhani Huttunen)
< Is it possible to distribute compiled templates in binary form, so that
< the user can use them as templates, or do you have to supply the source
< code for them?
< (As I understand it, distribution of compiled libraries is something
< that is required of c++ to be successful.)

Since templates don't exist yet, the answer is certainly no right now.

However, in the future, the answer will be a definite maybe! :-)

Seriously, consider what a template consists of: a model (the template) for a
class or function in which some type information is missing. The application
program will supply a type at compile time which will be melded with the
model to form a real class or function definition. The template will have to
be presented to the compiler in some form, but it won't necessarily have to
be in source form. If a vendor chooses, it may decide to permit some form of
"pre-parsing" to occur on templates. This would allow a library creator to
distribute a pre-parsed form of the template instead of raw source. Templates
pre-instantiated with certain types might be included in a library, but that
is a separate issue. For the application to create a version of the template
function or class at compile time, it needs access to the definition of the
template and not object. The object code for a class instantiated for one
type will be considerably different from the object code for a class
instantiated for another type, particularly if one is a built-in type and the
other is a class type. Is a pre-parsed version of a template close enough to what
you call a compiled template? I think the market place will have to decide.

By the way, there are many people who argue the premise that compiled libraries are
a must. It is certainly not a given.

     Tony Hansen
       hansen@pegasus.att.com, tony@attmail.com
    att!pegasus!hansen, attmail!tony




Author: Ari.Huttunen@hut.fi (Ari Juhani Huttunen)
Date: 30 Mar 91 13:23:32 GMT
Raw View
In article <1991Mar29.184915.9063@cbnewsk.att.com> hansen@pegasus.att.com (Tony L. Hansen) writes:

> Is a pre-parsed version of a template close enough to what
>you call a compiled template? I think the market place will have to decide.

Yes, this would give the vendor some kind of copyright protection. If this
protection is needed is not for me to decide (but for the market place as
you said.)

> If a vendor chooses, it may decide to permit some form of
>"pre-parsing" to occur on templates. This would allow a library creator to
>distribute a pre-parsed form of the template instead of raw source.

This has nothing to do with the C++-standard, but it would be profitable to
be able to compile the header files alone (to a pre-parsed version.) The
header files are not changed as often as the .c-files, but if there are
very many header files, this slows down compilation.
--
Ari Huttunen, email: Ari.Huttunen@hut.fi, phone: 90-7285944