Sujet : Re: question about linker
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 11. Dec 2024, 02:25:12
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjaplo$17cob$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
User-Agent : Mozilla Thunderbird
On 12/4/24 15:55, David Brown wrote:
On 04/12/2024 16:09, Bart wrote:
...
My remarks have been about the namespace that is created by a module.
>
I understand that C++ namespaces can be created in other ways, like
classes.
In reference to C++, I have been using the term "namespaces" the way C++
specifically defines the term "namespace". Perhaps I should have given
a reference to that in some way - this is comp.lang.c, after all.
What you are now talking about is what C calls "name spaces" - with a
space. C++ does not use that term in its standards (at least, not in
the C++20 standards I have open here) - it does not have a clear name
for the concept, as far as I have found. (I am not nearly as familiar
with the C++ standards as I am with the C standards, so if this matters
then perhaps someone else can chime in.)
The latest version of the C++ standard that I have is n4860.pdf, dated
2020-03-31. It has two occurrences of the phrase "name space" outside of
the section that descries differences from C:
8.2p1: "Labels have their own name space ..."
15.6p8: "There is one name space for macro names."
All other C++ identifiers reside in the ordinary name space
Those three namespaces all exist in C. In addition, each C struct or
union has a separate name space; C++ does not have the same rule, but
achieves a similar effect by giving those names a distinct scope.
In C struct, union, and enumation tags have their own namespace, in C++
they reside in the ordinary name space.
Half of all the differences between C and C++ that result in textually
identical code having different well-defined behavior in each language
are tied to differences in how name spaces and scopes work. Those
differences are deeply fundamental, and not easily removed.