Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: question about linker Date: Sun, 01 Dec 2024 14:04:17 -0800 Organization: None to speak of Lines: 51 Message-ID: <87bjxvqcv2.fsf@nosuchdomain.example.com> References: <87plmfu2ub.fsf@nosuchdomain.example.com> <87frnbt9jn.fsf@nosuchdomain.example.com> <877c8nt255.fsf@nosuchdomain.example.com> <20241129142810.00007920@yahoo.com> <20241129161517.000010b8@yahoo.com> <87mshhsrr0.fsf@nosuchdomain.example.com> <8734j9sj0f.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sun, 01 Dec 2024 23:04:21 +0100 (CET) Injection-Info: dont-email.me; posting-host="3f181db05453596f17a34ace05301cb8"; logging-data="2977014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ziZnwCAXhibJYsbBGkwo3" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:v9JLLImcBK8UJEkQ7kvG5NA79WQ= sha1:k+osau3GcixUGkjRAZga6zymQDI= Bytes: 3939 David Brown 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.com void Void(void) { Void(); } /* The recursive call of the void */