This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: array profile mode (was: Re: [patch] libstdc++/65352 fix ubsan errors in std::array<T, 0>)
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 1 Jun 2015 21:07:21 +0100
- Subject: Re: array profile mode (was: Re: [patch] libstdc++/65352 fix ubsan errors in std::array<T, 0>)
- Authentication-results: sourceware.org; auth=none
- References: <20150528115330 dot GL2985 at redhat dot com> <20150528144644 dot GS2985 at redhat dot com> <556CB420 dot 5040800 at gmail dot com>
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 :-)