This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [google gcc-4_7,gcc-4_8,integration] Add bounds checks to vector<bool>
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Diego Novillo <dnovillo at google dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 23 May 2013 10:13:25 -0700
- Subject: Re: [google gcc-4_7,gcc-4_8,integration] Add bounds checks to vector<bool>
- References: <ye6q7gip66eq dot fsf at elbrus2 dot mtv dot corp dot google dot com> <CALoOobNTTBRvLKLg_arRYbpRTA+oiVo2KyGd+owE6RB=+CFUZA at mail dot gmail dot com> <CAH6eHdQ5BihsSg5NuEMS8rZgk3Nu-0uF+ALTV1-rCy9s0uS_1g at mail dot gmail dot com>
On Thu, May 23, 2013 at 9:14 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> I was wondering the other day whether we should put these checks on
> trunk and enable them automatically when !defined(__OPTIMIZE__)
FWIW, we keep this under a separate macro so we can turn it on or off
independent of other build options.
Our current code looks like this:
#if !defined(__google_stl_debug_vector)
# if !defined(NDEBUG)
# define __google_stl_debug_vector 1
# endif
#endif
Keying off NDEBUG rather than __OPTIMIZE__ seems like a more
consistent approach -- if you want assert()s, then you probably also
want these checks.
--
Paul Pluzhnikov