This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Ooops...
And we try again...
Sorry!
/Stefan
Stefan Olsson wrote:
Benjamin Kosnik wrote:
My question is this - is sizeof(_Tp) evaluated at runtime or compile
time?
Compile time.
Alright, here's a diff that makes the allocator work again =)
Brgds
/Stefan
Thanks!
-benjamin
void:~/gcc/include/c++/3.4.0/ext$ diff ~/gcc-3.4-20040107/libstdc++-v3/include/ext/mt_allocator.h mt_allocator.h
235c235
< if (__n > _S_max_bytes)
---
> if (__n * sizeof(_Tp) > _S_max_bytes)
242c242
<
---
>
266c266
< size_t bin = _S_binmap[__n];
---
> size_t bin = _S_binmap[__n * sizeof(_Tp)];
411c411
< if (__n > _S_max_bytes)
---
> if (__n * sizeof(_Tp) > _S_max_bytes)
420c420
< size_t bin = _S_binmap[__n];
---
> size_t bin = _S_binmap[__n * sizeof(_Tp)];
610,615c610
< * _S_thread_freelist NOTE! Here's an ugly workaround - if
< * _S_thread_key_destr is not explicitly called at least
< * once it won't be linked into the application. This is the
< * behavior of template methods and __gthread_key_create()
< * takes only a pointer to the function and does not cause
< * the compiler to create an instance.
---
> * _S_thread_freelist
617d611
< _S_thread_key_destr(NULL);
669d662
<