[google gcc-4_7,gcc-4_8,integration] Add bounds checks to vector<bool>

Paul Pluzhnikov ppluzhnikov@google.com
Fri May 24 18:36:00 GMT 2013


Jonathan,

On Thu, May 23, 2013 at 10:13 AM, Paul Pluzhnikov
<ppluzhnikov@google.com> wrote:
> 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.

I'll be happy to try to push these changes into trunk, if you'd like me to.

The question is what macro(s) should guard the checks, and under what
conditions should they be turned on.

BTW, this is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56109

Thanks,
-- 
Paul Pluzhnikov



More information about the Gcc-patches mailing list