Deutsch   English   Français   Italiano  
<uspt5n$c2bg$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: =?UTF-8?B?UmU6IFdvcmQgRm9yIFRvZGF5OiDigJxVZ2xpZmljYXRpb27igJ0=?=
Date: Tue, 12 Mar 2024 15:42:48 +0000
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <uspt5n$c2bg$1@dont-email.me>
References: <uso6or$3t3jn$3@dont-email.me> <usopec$4eob$1@dont-email.me>
 <usort1$4t2r$1@dont-email.me> <20240312003531.349@kylheku.com>
 <wwvwmq7x4ex.fsf@LkoBDZeT.terraraq.uk> <usp9m5$7it7$1@dont-email.me>
 <20240312174600.5b88613545da9f667e06a4c6@g{oogle}mail.com>
 <uspqa4$bfao$1@dont-email.me>
 <20240312180904.ac3a5856df424c396689db3e@g{oogle}mail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Mar 2024 15:42:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cc591688dbaf79a334a7a98b0e4256c3";
	logging-data="395632"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/18lR80X5XugymIFmpC7GL"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Qa+z5sztjkon5gJpUZlUbQeMxNY=
In-Reply-To: <20240312180904.ac3a5856df424c396689db3e@g{oogle}mail.com>
Content-Language: en-GB
Bytes: 3071

On 12/03/2024 15:09, Anton Shepelev wrote:
> bart:
>> Anton Shepelev:
>>> David Brown:
>>>
>>>> The limited support for avoiding name clashes in C
>>>> (user-level C, outside of the implementation
>>>> internals) is certainly something that he (or others)
>>>> /could/ complain about.  It is a well-known issue, and
>>>> it's a shame that the C standards committee have never
>>>> dealt with it.  I don't see why the language could not
>>>> adopt a simple "namespace" solution that would hugely
>>>> simplify avoiding identifier clashes.  (It wouldn't
>>>> help for macros, but we have inline functions to
>>>> handle many cases.)
>>>
>>> My hypothetical solution is to have a single function
>>> returning a struct with pointers to all the public
>>> functions of a module.
>>
>> What stops that function name clashing with the single
>> function exported from other people's modules?
> 
> A much lower probability.
> 

I tried my C compiler with a couple of open source projects recently 
that both failed for the same mysterious reason.

It turned out that one of them used this line:

     #include "string.h"

and the other used:

     #include "malloc.h"

Notice they use "..." rather than <...>. These are not the standard 
headers, but user-written headers with the same names. (My compiler 
looks for them in the wrong order.)

People like reusing the same popular module names so much, they will 
even use the names of standard headers! Any exported function name is 
likely to be linked to the name of the module.

 >>> returning a struct with pointers to all the public
 >>> functions of a module.

There may be an additional clash-point with exposing the name of the struct.