[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hi everybody!



Michael Day wrote:

>> AFAIK it's only for templates...
>> And I only use egcs, so I can't really comment ont the compiler thing ;)
>
>Strange, sounds like the old gcc pragma template hack. Is it an ansi
>keyword? I was pretty sure I knew all the new ones, but eh a few more
>wouldn't hurt :) 

That's what Stroustrup says ("The C++ Programming Language, 3rd Ed.", Sect
9.2.3, last paragraph, pg. 205):
---- quote ----
A template definition can be #included in several translation units as long
as the ODR [one-definition-rule] is adhered to. In addition, an exported
template can be used given only a declaration:

  // file1.c:
       export template<class T> T twice (T t) { return t+t; }

  // file2.c:
       template<class T> T twice (T t);  // declaration
       int g (int i) { return twice (i); }

The keyword export means "accessible from another translation unit" (§13.7).
---------------


	Christian

--

Drive A: not responding...Formatting C: instead