Re: A: a new bug to old plain C

Александр Поваляев via Gcc-h elp <[email protected]>
Newsgroups gmane.comp.gcc.help
Message-ID <CAGT+J5x3DBEOo1pwAYdamsLZY_8xGLZHNjqTJYX7Ouy=nM8rBw@mail.gmail.com>
Hi there!

The code is not invalid and neither of the links posted saying that "const
Foo * const * const" is invalid construction for C.
The links posted just are discussing that it might be UNSAFE to cast "Foo
**" -> "const Foo **" and recommending usage of "Foo **" -> "const Foo *
const *" instead.
It's OK. If you feel that it is unsafe, please don't use it. It is your own
decision.

But the syntax itself "const Foo * const * const" is correct and the
use-case I mentioned is quite simple and evident.
And so I need this code snipped to be compiled transparently over all the
GCC (and platform SDKs) available versions.

Respectfully,
Aleksandr G Povaliaev.


пн, 24 нояб. 2025 г. в 01:48, David Brown <[email protected]>:

> On 23/11/2025 21:45, Александр Поваляев via Gcc-help wrote:
> > Hi there!
> >
>
> This is getting /extremely/ frustrating.  /Please/ find some way to
> learn the C programming language - courses, books, good online resources.
>
> And /please/ believe me when I say that people who have worked with C
> and C++ for decades, studied the standards, who serve on the standards
> committee, know better about these things than you do.  (I'm talking
> about Jonathan here, not myself - he really is a world-class expert here.)
>
> > Either the links you've provided or the links you provided earlier
> > (yesterday) are irrelevant, cause they are just discussing if it is safer
> > to convert "Foo_Type **" to "const Foo_Type **" or not.
> >
>
> The links are highly relevant.  They explain why you cannot convert from
> "char **" to "const char **".  That also explains why you cannot convert
> from "char **" to "const char * const * const".  Adding even more
> "const" qualifiers to the invalid conversion does not somehow magically
> make it work.
>
> > Once again, we are not converting "char** to const char**", we're
> > converting char** to const char * const * const".
> > And we're not discussing if it is safer or not, we are discussing GCC
> > compiler error.
> >
>
> The compiler is generating an error message because you wrote invalid
> code.  The error - or bug, if you like - is in /your/ code.  Not the
> compiler.  GCC is doing its job correctly here.
>
> >
> > Respectfully,
> > Aleksandr G Povaliaev.
> >
>
> I'm sorry, but signing the post with "respectfully" does not make it
> respectful.  You started the thread disrespectfully - insisting that
> there is a bug in GCC when you simply do not understand the relevant
> aspects of the C programming language.  And you have gone downhill since
> then, ignoring and rejecting the help and advice you have been given.
> Getting things wrong once is entirely understandable - this is a subtle
> point of the C language, and you are posting to a "help" list.  Doubling
> down on your ignorance when you have received the help and information
> you need, is a different matter entirely.
>
> Your code is flawed.  You need to fix it.  Mindlessly repeating your
> misunderstandings about how you think C works will not do anything but
> annoy people.
>
> David
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.