about summary refs log tree commit diff stats
path: root/055shape_shifting_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-28 18:12:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-28 18:37:57 -0700
commit5f05e954ee1f1daf953b3ff20af81775f226d5bf (patch)
tree21a691619f0e260e18df4140d4d8381682ecd979 /055shape_shifting_container.cc
parentc7fde8d4e4175b436bc8db92bedd231261827e2c (diff)
downloadmu-5f05e954ee1f1daf953b3ff20af81775f226d5bf.tar.gz
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)
Diffstat (limited to '055shape_shifting_container.cc')
-rw-r--r--055shape_shifting_container.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc
index d49da7ab..5c5f6b93 100644
--- a/055shape_shifting_container.cc
+++ b/055shape_shifting_container.cc
@@ -79,13 +79,13 @@ container foo:t [
 ]
 +error: foo: type ingredient 't' must begin with an underscore
 
-:(before "End Constants")
+:(before "End Globals")
 // We'll use large type ordinals to mean "the following type of the variable".
 // For example, if we have a generic type called foo:_elem, the type
 // ingredient _elem in foo's type_info will have value START_TYPE_INGREDIENTS,
 // and we'll handle it by looking in the current reagent for the next type
 // that appears after foo.
-const int START_TYPE_INGREDIENTS = 2000;
+extern const int START_TYPE_INGREDIENTS = 2000;
 :(before "End Commandline Parsing")  // after loading .mu files
 assert(Next_type_ordinal < START_TYPE_INGREDIENTS);