array profile mode (was: Re: [patch] libstdc++/65352 fix ubsan errors in std::array<T, 0>)
Jonathan Wakely
jwakely@redhat.com
Mon Jun 1 20:07:00 GMT 2015
On 01/06/15 21:36 +0200, François Dumont wrote:
>On 28/05/2015 16:46, Jonathan Wakely wrote:
>>1) Why do we even have _profile::array? What's it for?
>
> There is no profiling code in array, indeed. This is so just for
>consistency with Debug mode. As soon as one of the alternative mode is
>activated normal implementation is put within __cxx1998 namespace and
>you need to provide an alternative implementation, potentially
>referencing the latter.
Ah yes, of course.
>I tried once to do:
>
>namespace std
>{
>namespace __profile
>{
> template<typename _Tp, std::size_t _Nm>
> using array = _GLIBCXX_STD_C::array<_Tp, _Nm>;
>
>}
>}
>
>but it doesn't work as we can't expose a template alias to user code
>in place of a struct.
Yeah.
>So we could:
>1. Have a special management of array in normal mode, not put it in
>__cxx1998 when only profile mode is activated.
>2. Use inheritance on the normal implementation to reduce amount of
>duplicated code.
>
>I will have a try in coming days.
It's not a big problem, if I remember to fix the debug mode one I'll
remember to fix the profile mode one too.
I'd still prefer to just remove profile mode :-)
More information about the Libstdc++
mailing list