Defining global constant in C++
<p>I want to define a constant in C++ to be visible in several source files.
I can image the following ways to define it in a header file:</p>

<ol>
<li><code>#define GLOBAL_CONST_VAR 0xFF</code></li>
<li><code>int GLOBAL_CONST_VAR = 0xFF;</code></li>
<li>Some function returing the value (e.g. <code>int get_GLOBAL_CONST_VAR()</code>)</li>
<li><code>enum { GLOBAL_CONST_VAR = 0xFF; }</code></li>
<li><code>const int GLOBAL_CONST_VAR = 0xFF;</code></li>
<li><code>extern const int GLOBAL_CONST_VAR;</code>
and in one source file <code>const int GLOBAL_CONST_VAR = 0xFF;</code></li>
</ol>

<p>Option (1) - is definitely not the option you would like to use</p>

<p>Option (2) - defining instance of the variable in each object file using the header file</p>

<p>Option (3) - IMO is over killing in most cases</p>

<p>Option (4) - in many cases maybe not good since enum has no concrete type (C++0X will add possibility to define the type)</p>

<p>So in most cases I need to choose between (5) and (6).
My questions:</p>

<ol>
<li>What do you prefer (5) or (6)?</li>
<li>Why (5) is ok, while (2)  is not?</li>
</ol>
