Deutsch   English   Français   Italiano  
<vjgqau$39p95$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: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Fri, 13 Dec 2024 09:13:18 +0100
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <vjgqau$39p95$1@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me> <vi6sb1$148h7$1@paganini.bofh.team>
 <vi6uaj$3ve13$2@dont-email.me> <87plmfu2ub.fsf@nosuchdomain.example.com>
 <vi9jk4$gse4$1@dont-email.me> <vi9kng$gn4c$1@dont-email.me>
 <87frnbt9jn.fsf@nosuchdomain.example.com> <viaqh0$nm7q$1@dont-email.me>
 <877c8nt255.fsf@nosuchdomain.example.com> <viasv4$nm7q$2@dont-email.me>
 <vibr1l$vvjf$1@dont-email.me> <vic73f$1205f$1@dont-email.me>
 <20241129142810.00007920@yahoo.com> <vicfra$13nl4$1@dont-email.me>
 <20241129161517.000010b8@yahoo.com> <vicque$15ium$2@dont-email.me>
 <vid110$16hte$1@dont-email.me> <87mshhsrr0.fsf@nosuchdomain.example.com>
 <vidd2a$18k9j$1@dont-email.me> <8734j9sj0f.fsf@nosuchdomain.example.com>
 <vihhkj$2er60$1@dont-email.me> <vjg0ta$31fff$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Dec 2024 09:13:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="f0540cf273b21a8c1d582ae5f5d2a6e9";
	logging-data="3466533"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18gkKzwng2IRjEnoHODRxWz3sDQ+XmDISA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:O6kX0fBtNU97Bm7sJjWIElRLdBY=
Content-Language: en-GB
In-Reply-To: <vjg0ta$31fff$1@dont-email.me>
Bytes: 4415

On 13/12/2024 01:59, James Kuyper wrote:
> On 12/1/24 06:34, David Brown wrote:
>> On 30/11/2024 00:44, Keith Thompson wrote:
> ...
>>> David apparently has a different definition of "totally different types"
>>> than you do.  Since the standard doesn't define that phrase, I suggest
>>> not wasting time arguing about it.
>>>
>>
>> "int", "void" and "double" are totally different types in my view.
>> "int", "pointer to int", "array of int", "function returning int" all
>> have a relation that means I would not describe them as /totally/
>> different types - though I would obviously still call them /different/
>> types.
>>
>> The syntax of C allows one declaration statement to declare multiple
>> identifiers of types related in this way - it does not allow declaration
>> of types of /totally/ different types.
> 
> There's a rule I sometimes find useful, when trying to choose a precise
> definition for a poorly defined term: figure out what statements you'd
> like to say using the term, then define it in such a way as to guarantee
> that those statements are correct.
> 
> In C, a declaration may contain an init-declarator-list, preceded by
> declaration-specifiers and optionally by an attribute-specifer-sequence
> (6.7p1). Each of the declarators in the list share the
> declaration-specifiers and the attribute-specifier-sequence (6.7p7). Any
> syntax that's part of a declarator applies to that declarator's identifier.
> 
> Therefore, your statement suggests that two types should be considered
> "totally different types" if they are incompatible in either the
> declaration-specifiers or the attribute-specifier-sequence. With that
> definition, 6.7p7 in the standard would guarantee the truth of your
> statement above.
> 
> Does that definition sound suitable?

That definition sounds correct, yes, but also completely useless.  It 
leads directly to a tautology - you can declare two things in the same 
declaration in C if you are allowed to declare them in the same 
declaration in C.  I was simply trying to give such "things" can't have 
/totally/ different types, but need types that are in a certain way 
related.  I didn't go into the details of how they had to be related, 
because it should have been obvious that those details are precisely 
what the C standard says in the section about declarations.

It turns out that my comments there did not really help much - most C 
programmers already understand this stuff, and the poster who says he 
finds it all confusing likes to view every explanation as more confusing.

So I think this is best dropped.