Re: A: a new bug to old plain C
Andrey Tarasevich via Gcc-help <[email protected]> Wed, 10 Dec 2025 07:03:16 -0800 (PST)
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <[email protected]> |
> On 12/10/2025 4:58 AM PST Александр Поваляев via Gcc-help <[email protected]> wrote: > We considered some examples (both passing through function parameter and > assignment) where "Foo**" -> "const Foo * const * const" conversion might > happen. What we are collectively trying to teach you here, is some obscure but _very_ _relevant_ basic facts about C language. And the specific piece of knowledge we are focusing on now (and have been trying to convey to you for quite a while) is the fact that when you pass an argument of type `Foo **` to function whose parameter is declared as `const Foo * const * const`, the implicit conversion the language will be trying to apply is a conversion to `const Foo * const *` type (note: no trailing `const`). Conversions with top-level `const` simply do not exist in C. So, if you will be spelling this conversion out explicitly (as a cast), which is exactly what we were talking about it just might make more sense to spell out the same conversion the C language itself would use: a conversion to `const Foo * const *`. It is just shorter. This little important detail is something you seem to be having trouble getting since the very start. But there's no other way around. You are going to have to make an effort and get it, if you want to understand the matter at hand. > I am not sure about the examples you have just mentioned. I am not sure > they are very rare and it looks like they (examples) are a little bit > irrelevant to the subject matter being discussed within this e-mail thread. The examples are relevant in a sense that they are here to teach you something you seem to have trouble understanding even after multiple repetitive attempts with more convoluted examples. The examples are designed to be very simple, they are basically an application of "explain it with sock puppets" technique. And you don't get to doubt them. You get to study them attentively and ask polite questions if something is still unclear to you. Otherwise, there's no hope for you to understand the matter. In that unfortunate case we'll just have to file it under "H" for "hopeless". -- Best regards, Andrey