This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Optimization/clarity coding : what is gcc able to do for me ?


On Sat, Jan 15, 2005 at 04:21:23PM +0100, jlh wrote:
> 
> Nick NoSpam wrote:
> > So since one thread is reading (size() is a const method), and another may
> > be writing (perhaps adding new elements), it's fine for such implementations.
> 
> Only if you can ensure both operation to not happen at the same time.  If you
> call size() while another thread is just resizing the vector, you might get
> wrong results.

You are laboring under a mistaken impression: the C++ standard does not
require this level of thread safety and no C++ compiler or library
provider provides that kind of thread safety (as the cost would be
enormous for non-threaded programs).


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