Sujet : Re: question about linker
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 01. Dec 2024, 23:04:17
Autres entêtes
Organisation : None to speak of
Message-ID : <87bjxvqcv2.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
David Brown <
david.brown@hesbynett.no> writes:
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 following is not intended as a criticism. I think "totally
different types" was a throwaway phrase applying to a specific context,
and I have no problem with that. It refers to types that cannot be
combined in a single declaration. I don't think its a suitable term for
more general use (and I'm sure it wasn't intended to be). There might
be a clearer phrase, but I don't really think we need a term for it at
all (outside that one throwaway context).
If we needed a definition, we could refer to the discussion of "derived
types" in section 6.2.5 (Types) of the C standard.
And you explained it clearly enough when you first used it.
[...]
A function definition - as typically written - is also a function
declaration. So presumably you mean non-defining declaration here.
Yes.
Some people have a style where they write forward declarations of all
functions defined in a C file near the top of the file. I am not a
fan of that myself - especially as over time, this redundant
information is rarely kept fully in sync with the rest of the code.
But it is definitely something you'll sometimes see in real-world C
code. (You could argue that the code is then not "well-written" C,
but that would be a very subjective opinion.)
Yes, that was an oversight on my part.
If someone wanted to ensure that all static functions defined in a
translation unit are declared near the top, there could be a separate
tool to generate, or at least check, the declarations. I'm not aware of
any such tool, which suggests there probably isn't much demand for it.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */