Why is the C++ scope resolution operator ::?
This is one of the few questions I didn't find an answer to in Design and Evolution of C++ by Stroustroup. Why is the C++ scope resolution operator ::, as opposed to just :?
I'm guessing it's becaus开发者_运维百科e : is already used to indicate the start of an initialization list in a constructor. Does anyone else agree, disagree, or have a definitive answer on this?
It would create an ambiguity with goto
labels, for one.
foo:bar; // is foo a label or a namespace?
精彩评论