Sujet : Re: question about linker
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 13. Dec 2024, 01:59:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjg0ta$31fff$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
User-Agent : Mozilla Thunderbird
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?