From: Arnaud Giersch Date: Thu, 3 Nov 2011 13:20:32 +0000 (+0100) Subject: Use static instead of volatile for variables that may be clobbered by a TRY..CATCH. X-Git-Tag: exp_20120216~5 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/09d41417e496c5599b00a615f4b3d67b0f6270f3?ds=inline;hp=779b929d3831ca0aea2f667029d6381946c86e01 Use static instead of volatile for variables that may be clobbered by a TRY..CATCH. --- diff --git a/main.cpp b/main.cpp index 8dbbc79..011b258 100644 --- a/main.cpp +++ b/main.cpp @@ -194,9 +194,10 @@ static void install_signal_handler() int main(int argc, char* argv[]) { - // Note: variables used after THROW must be declared as volatile. - volatile int exit_status = 0; // global exit status - volatile double simulated_time = -1.0; + // Note: variables modified between TRY (setjmp) and THROW (longjmp) + // must be declared as static or volatile. + static int exit_status = 0; // global exit status + static double simulated_time = -1.0; timestamp elapsed_time(timestamp::wallclock_time); timestamp simulation_time(timestamp::cpu_time); xbt_ex_t ex;