This is the mail archive of the
mailing list for the GCC project.
Re: Optimization/clarity coding : what is gcc able to do for me ?
- From: dewar at gnat dot com (Robert Dewar)
- To: gcc at gcc dot gnu dot org, jlh at gmx dot ch
- Date: Sat, 15 Jan 2005 09:11:57 -0500 (EST)
- Subject: Re: Optimization/clarity coding : what is gcc able to do for me ?
> 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.
There is no rule against the use of shared variables, yes, of course you
have to be careful, but there are many algorithms that use variables
that are read by one task and written by another, that work fine. Surely
you are not claiming that these algorithms are never allowed in C.