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?



Nick NoSpam wrote:
2.  Can the compiler optimize the size() call away (after calling it
once)?  What if the vector was accessible in another thread?  The other
thread could modify the vector simultaneously.

That code wouldn't be thread-safe. If two threads need to access the same vector, you'd have to use a mutex, or bad things could happen.

jlh

Attachment: signature.asc
Description: OpenPGP digital signature


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