Boost logo

Boost :

From: Ken Hagan (K.Hagan_at_[hidden])
Date: 2003-02-19 09:27:37

Peter Dimov wrote:
> &k does not exist yet at compile-time (in a pointer to int form), when
> templates are instantiated.

It doesn't have to. We're instantiating a template, not calling a
function, so if "&k" has the type "pointer to thread-local int" then
the compiler knows that and can instantiate the appropriate code.

One might insist that the addresses of TLS data be qualified (like
__near and __far on the old 8086 boxen) and template authors would
have to declare up front which type of pointer they were expecting.
This would be a break with existing practice and the only benefit
would be that one could declare functions (not templates) that
expected a thread-relative pointer. I don't think this is worth it.

Twenty years ago, being able to declare a DS-relative pointer *was*
worth it, since the speed-up outweighed the inconvenience of all
those qualifiers. For TLS, unless we go mad and make most of our
application data thread-local (!), the convenience of mixing and
matching is more valuable than the expressiveness.

Boost list run by bdawes at, gregod at, cpdaniel at, john at