This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bounds checking in bitset.


On Sat, Feb 04, 2006 at 10:21:46AM +0100, Paolo Carlini wrote:
> BHARAT JOSHI wrote:
> 
> >> Maybe your doubt stems from expections pre-DR 11. In the current
> >> standard, C++03, operator[] does *not* throw and requires a valid
> >> position (user responsability). See 23.3.5.2/46-47, 49-50.
> >
> > though this is true of standard containers, its not the case for
> > bitset. by standard
> >   "The subscript operator throws out_of_range if subscript is out of
> >    range. There is *no* unchecked subscript operation."
> 
> I have no idea which document you have at hand, certainly it is *not*
> the current C++ standard (14882: 2003), which we are implementing. I
> pointed you to the exact sections: again, 23.3.5.2/46-47, 49-50. Please
> look closer.
> 
> Thanks,
> Paolo.

Unfortunately Bharat, while Stroustrup (which while a fine book, should not be
confused with the actual standard) is quite clear on this particular case, what
he wrote only reflects C++ as it was in the previous version of the standard,
C++98. It appears that bitset has changed in an incompatible way in C++03, and
that is the behavior you are seeing with GCC now.

-Jack


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]