From 5f05e954ee1f1daf953b3ff20af81775f226d5bf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 28 Aug 2016 18:12:03 -0700 Subject: 3273 Undo 3272. The trouble with creating a new section for constants is that there's no good place to order it since constants can be initialized using globals as well as vice versa. And I don't want to add constraints disallowing either side. Instead, a new plan: always declare constants in the Globals section using 'extern const' rather than just 'const', since otherwise constants implicitly have internal linkage (http://stackoverflow.com/questions/14894698/why-does-extern-const-int-n-not-work-as-expected) --- 082scenario_screen.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '082scenario_screen.cc') diff --git a/082scenario_screen.cc b/082scenario_screen.cc index 01750bb0..3321a7fc 100644 --- a/082scenario_screen.cc +++ b/082scenario_screen.cc @@ -133,7 +133,7 @@ $error: 0 //: locations. :(before "End Globals") -const int Max_variables_in_scenarios = Reserved_for_tests-100; +extern const int Max_variables_in_scenarios = Reserved_for_tests-100; int Next_predefined_global_for_scenarios = Max_variables_in_scenarios; :(before "End Setup") assert(Next_predefined_global_for_scenarios < Reserved_for_tests); @@ -143,10 +143,10 @@ assert(Next_predefined_global_for_scenarios < Reserved_for_tests); // initialize a default-space. assert(Name[tmp_recipe.at(0)][""] < Max_variables_in_scenarios); -:(before "End Constants") -// Fixed Scenario Locations. -const int SCREEN = Next_predefined_global_for_scenarios++; -// End Fixed Scenario Locations. +:(before "End Globals") +// Scenario Globals. +extern const int SCREEN = Next_predefined_global_for_scenarios++; +// End Scenario Globals. //: give 'screen' a fixed location in scenarios :(before "End Special Scenario Variable Names(r)") -- cgit 1.4.1-2-gfad0