I read this page.
C++ header files with no extension
And I understood that comment as saying that namespaces existed even before the introduction of the C++ standard.
So wasn't that comment saying that namespaces and the absence of file extension are not related?
However, the following comment didn't mention how namespaces were used when using cout in iostream.h.
So my Questions are:
- Did the namespace really exist prior to the introduction of the C++ 98 standard?
- If it is true, how namespaces were used when using
coutin iostream.h?
The committee voted to accept namespaces into the standard in 1993. Most compilers supported it fairly shortly after that, so for around 5 years before the standard was approved.
Headers without extensions happened around the same time, so mostly when you used
iostream.h, you just usedcout << foo;, and when you switched toiostream, you usedstd::cout << foo;.For backward compatibility, many compilers continued to supply an
iostream.hfor a while after they hadiostream. It was often something like this:This was enough for a lot of fairly simple programs to compile, but broke with some that got into the dark corners of the older library code (and honestly, not even very dark corners).
Other compilers had two completely separate libraries though, so
iostream.hcontained declarations for one andiostreamfor the other.