Topic: New keyword export? What's wrong with extern?


Author: Ted Clancy <s341282@student.uq.edu.au.SPAM_REPELLENT>
Date: 1997/04/06
Raw View
Ted Clancy wrote:
>
> Paragraph 6 of chapter 14 [temp] in the CD2 says that if I want to use
> externally defined templates, I have to use the keyword export, like so:
>
>   export template<typename T> class MyClass {
>   ...
>   };
>
>   MyClass x;
>
Sorry, ignore some of that last message. I didn't read the line in the
CD2 that says "A template shall be exported only once in a program."

Still, I think using extern instead could be good too. It saves
introducing a new keyword, and it won't conflict with the way some
compilers already use the word export. Some would say this is giving
extern another meaning, but I think it already has this meaning when
used with const.

or should we start saying
  export const int x=5;
and make
  extern const int x=5;
depreciated to give extern just one meaning, the same way static at file
level was depreciated to give "static" only one meaning?

--
Ted Clancy
s341282@student.uq.edu.au
BE/BA, University of Queensland.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Ted Clancy <s341282@student.uq.edu.au.SPAM_REPELLENT>
Date: 1997/04/07
Raw View
Paragraph 6 of chapter 14 [temp] in the CD2 says that if I want to use
externally defined templates, I have to use the keyword export, like so:

  export template<typename T> class MyClass {
  ...
  };

  MyClass x;

Why introduce the keyword export? Was there something wrong with using
extern?

As far as I can tell from the grammar summary, extern has no current
meaning on a template-declaration, so why not use it for externally
defined templates? It is already part of the C/C++ vocabulary for "the
definition is supplied in another translation unit (or defined later on
in this translation unit and useable by others)".

I make this complaint because
1) I don't like new unnecessary keywords
2) The word "export" doesn't usually mean (in English) "get the
definition from elsewhere".
3) The token "export" is already used in this format by compilers on
some operating systems (like BC++ for Windows) to make a function,
class, or template useable from other applications or dynamic link
libraries.

I know that the resolution of the internally-/externally-defined
template problem was only recently agreed on, so I hope the committee is
still open to changing the export keyword if it's possible to do so.

--
Ted Clancy                         | "...This is Pauline Hanson of Borg
s341282@student.uq.edu.au          |     Resistance is futile
BE/BA, University of Queensland.   |     You _will_ be assimilated..."
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]