program executin times differ between gcc versions

John (Eljay) Love-Jensen eljay@adobe.com
Thu Nov 1 16:25:00 GMT 2007


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



More information about the Gcc-help mailing list