Sujet : Re: do { quit; } else { }
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 10. Apr 2025, 20:11:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vt9544$3hhr8$2@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
User-Agent : Mozilla Thunderbird
On 10/04/2025 17:51, Kaz Kylheku wrote:
On 2025-04-10, bart <bc@freeuk.com> wrote:
In my C compiler, each type has a unique index which is what is compared
to see if two types are the same type. It has nothing to do with tags.
How can it not?
struct tag;
struct tag { ... };
these have to refer to the same type; how do you do that without tags?
The type can be denoted in the source code using 'struct tag'. Looking 'tag' up in the ST, checking only names belonging to the special tag namespace, will yield an entry that has its type index, whatever that happens to be.
But the tag is not what is used when comparing two types. It is just an anachronistic concept that C still needs.
(In C++ I understand that special tag namespaces don't exist, they are just part of the normal namespace.
And in my languages they have never been a concept, yet I can still compare one struct type with another.)