== Why is this an issue?

The execution order of ``++static++`` initializers is unspecified when they are in different compilation units (files). Relying on a particular initialization order can have nasty repercussions and should therefore be avoided. Even if the code works now, it could change in the future without notice.


If you need to use ``++static++`` globals, you should put them inside the function that uses them, or create a getter and declare them inside that getter.


=== Noncompliant code example

[source,cpp]
----
static const std::string airports[] = {"GVA", "SFO", "CDG"}; // Noncompliant
----


=== Compliant solution

[source,cpp]
----
std::string GetAirportCode(int i) {
  static const std::string airports[] = {"GVA", "SFO", "CDG"};
  return airports[i];
}
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Move this "static" initializer into a getter or the function that uses it.


=== Highlighting

``++static++``


endif::env-github,rspecator-view[]
