|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-02-14 15:30:28
Ulrich Eckhardt wrote:
> Jonathan Turkanis wrote:
>> Three iostreams tests are failing with the toolset msvc-stlport. All
>> the unresolved symbols are specializations of standard library
>> function templates.
> Anyhow, the problem is the compiler that has problems with code where
> 0. 1200 <= _MSC_VER < 1300 (this affects only VC6 and eVC4, AFAICT)
> 1. a class (not functions!) is imported from a library (e.g.
> _STL::locale)
> 2. the class contains template functions or ctors
> 3. inlining is deactivated
<snip explanation of workarounds>
Thanks for the detailed explanation!
Unfortunately, while I could try to apply the workarounds to get the regression
tests to compile, it would give library users a false sense of security since
user-code likely won't instantiate these standard library member functions with
the same template arguments as the tests. For example, the class
stateless_null_padded_codecvt which showed up in the errors I listed is
completely useless except for testing.
> b) determining whether inlining is active is non-trivial, to be
> honest I haven't found a way yet, but also didn't search too hard.
> The problem is that e.g. _DEBUG/NDEBUG can't be used, not only
> because you can still toggle inlining by hand but also because some
> version of MSC 12 (the compiler version included in e.g. VC6, but
> also in eVC4) simply don't do inlining - only the versions supplied
> with the enterprise version support this. I believe that the eVC4
> versions (at least the version freely downloadable) never do inlining.
> Just wondering, but is there a way to force a function to not be
> inlined or vice versa?
You can keep a function from being inlined using #pragma auto_inline(off/on),
but this does not apply to functions defined with the inline keyword or (I
think) defined within the class definition.
You can try to force inlining using __forceinline and pragma
inline_recursion(on), but this is guaranteed to work always. Obviously it won't
work for versions of the compiler which don't do inlining.
Now that I understand the problem, I think I'm willing to document the library
as being partially broken on msvc with STLPort without inlining.
I'm glad to know it's not a bug in the iostreams library. Thanks for your help!
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk