This is the mail archive of the gcc-help@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: program executin times differ between gcc versions


Hi Marco,

> If you have variables that might be modified by multiple threads you should declare them as volatiles in order to prevent compiler optmization and wrong execution.

NOTE:  the "volatile" qualifying keyword by itself does not prevent problems with multiple threads modifying the variable concurrently.

Neither C nor C++ have language support for multiple threads.  (There are "bolt-on" threading libraries, but that's not the same as multiple threads being supported by the language -- "volatile" is orthogonal to resolving issues due to multiple threads.)

Sincerely,
--Eljay


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