Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: James Kuyper Newsgroups: comp.lang.c Subject: Re: question about linker Date: Tue, 10 Dec 2024 20:25:12 -0500 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: <20241129142810.00007920@yahoo.com> <20241129161517.000010b8@yahoo.com> <87mshhsrr0.fsf@nosuchdomain.example.com> <8734j9sj0f.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 11 Dec 2024 02:25:14 +0100 (CET) Injection-Info: dont-email.me; posting-host="bba43852df68bc0bc6dea6dfa4046055"; logging-data="1291019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FwnN0RtBSfbkx27IO4O4ZYyKyVmeeG3A=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:VBJYKbOwAT2o94Pdg++As6HRpIA= Content-Language: en-US In-Reply-To: Bytes: 3777 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.