[LLVMdev] inlining hint
Sebastian Redl
sebastian.redl at getdesigned.at
Thu Aug 27 08:16:44 PDT 2009
Cédric Venet wrote:
> I just
> didn't and still don't understand how you do it, but this is probably
> not the good place to discuses this.
>
>
> What about multiple translation unit then? because from my
> understanding, this will generate multiple definition of symbol, so you
> will never be able to link it (except with some strange link
> specification (weak or something like this) which seem less portable
> than declaring the function inline).
The standard requires the compiler/linker to be able to handle
non-inline template functions defined in headers, because without them,
implicit instantiation simply wouldn't work.
Therefore, it's always possible to define function templates
out-of-line, but still in the headers - it's just sometimes incredibly
ugly, especially when you have member templates of class templates.
(Also, some ancient compilers don't support the out-of-line definition
syntax.)
It's also common to move these out-of-line definitions to their own
file, which is included at the bottom of the header file, so as to not
clutter the declaration file.
Sebastian
More information about the llvm-dev
mailing list