logoalt Hacker News

edf13 • today at 5:32 PM • 1 reply • view on HN

Any links to the historical reason for C++ using ::?


Replies

kreco • today at 5:45 PM

I don't have a link but you can search on the web. I have the .pdf on my computer.

From "A History of C++: 1979− 1991".

> In C with Classes, a dot was used to express membership of a class as well as expressing selection of a member of a particular object. This had been the cause of some minor confusion and could also be used to construct ambiguous examples. To alleviate this, :: was introduced to mean membership of class and . was retained exclusively for membership of object.

It was taken from Algol68.

Then, this was reused for namespaces for consistency reason.