<pre><code>const static int foo = 42;
</code></pre>

<p>I saw this in some code here on StackOverflow and I couldn't figure out what it does. Then I saw some confused answers on other forums. My best guess is that it's used in C to hide the constant <code>foo</code> from other modules. Is this correct? If so, why would anyone use it in a C++ context where you can just make it <code>private</code>?</p>

It's missing an 'int'.  It should be:
```
```
const static int foo = 42;
```
```
In C and C++, it declares an integer constant with local file scope of value 42.
Why 42?  If you don't already know (and it's hard to believe you don't), it's a refernce to the
Answer to Life, the Universe, and Everything
.