Optimization/clarity coding : what is gcc able to do for me ?
jlh
jlh@gmx.ch
Sat Jan 15 15:12:00 GMT 2005
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050115/389c4a2a/attachment.sig>
More information about the Gcc
mailing list