News for hackers. Stuff that matters.
Re:Volatile is Evil by dfox on Saturday February 12, 2011 @08:08AM (#2209949)
Reason for this is that static actually does exactly same thing in both cases: defines global variable without externally accessible name and makes it accessible in enclosing scope. (exact standarteese being "internal linkange with static storage duration")
Re:Volatile is Evil by alextgordon on Saturday February 12, 2011 @09:04AM (#2210012)
It's actually quite remarkable the number of places a single keyword can be used. We have

  * Static functions in C
  * Static variables in C
  * Static members in C++
  * Static instance variables in Java
  * Static methods in Java
The strange combination of C++'s namespaces and static begets static members, which almost make sense in context. But then Java stole the syntax and not the rest of the language (thank god), leading to its strange, almost contradictory usage.
Re:Volatile is Evil by pivo on Saturday February 12, 2011 @09:16AM (#2210028)
In Java there are also static inner classes and static initializers (static code blocks that initialize static data)