Re: A: a new bug to old plain C

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

My reply gives a detailed description why the arguments you provided are
not correct (as for the formal logic). Please try to be more accurate.
We're talking about GCC (as I wrote in my original response to committee),
not C++.

And what I asked for is if С standard explicitly prohibits "Foo**" ->
"const Foo * const * const" conversion.
And I have not received any confirmation of it either from you or from the
other participants of this e-mail thread.

We're talking about the point which was implemented differently by
compilers (see my previous post within the code snippet).
And I am wondering why the things which are not explicitly prohibited by C
standard are interpreted as errors, not warnings.

As for now the bottom line: about 50% of well known C compilers don't
interpret "Foo**" -> "const Foo * const * const" conversion as an error and
there is no explicit prohibition of it by C standard.
Right?

As for "Foo**" -> "void*" -> "const Foo * const * const" conversion
proposal. Yep it will work fine also, without error (see the results below).
But once again, I would prefer not to deviate from the original topic.
Thank you for your participation to this discussion.

void subfunc(struct zzz const * const * const arg) {

if (arg != NULL) {
printf("%s", "Done!");
}
}

void func(struct zzz ** arr_of_ptr, unsigned count) {

subfunc((void*)arr_of_ptr); // CLANG: x86-64 clang (trunk) - OK!
// GCC: x86-64 gcc (trunk) - OK!
// INTEL: x86-64 icc 2021.10.0 - OK!
// MICROSOFT(c++?): x64 msvc v19.latest - OK!
// POWER64 GCC trunk - OK!
// ARM gcc(trunk) - OK!
// NOTE: based on godbolt.org
}

Respectfully,
Aleksandr G Povaliaev.

ср, 26 нояб. 2025 г. в 19:14, LIU Hao <[email protected]>:

> 在 2025-11-26 21:48, Александр Поваляев 写道:
> > I want to emphasize here "One of the following shall hold"!.
> > So, if one of the following is being hold, the conversion/assignment is
> permitted.
>
> > But USE THE SAME TRICK WITH DISJUNCTION AND CONJUNCTION to prove that
> "Foo**" -> const Foo * const *
> > const" is not correct.
> > IT IS WRONG WAY.
> > To be logically correct you need to show that NO ONE OF THE 6.5.17.2
> STATEMENT is TRUE for "Foo**" ->
> > const Foo * const * const" logic.
>
> If you had read the damn standard, you would have known that the others
> are all about arithmetic types,
> structs and unions, pointer to void, and conversion to `bool`, and
> apparently they do not apply. Pity.
>
> Because you are writing C, you don't need to cast the pointer to `struct
> zzz const * const * const`; you
> just cast to `void*`. If you don't know that, you cannot know more C than
> me.
>
> I'm already very disappointed about this thread, because half of the
> messages are about `char **` does
> not implicit convert to `const char **` which is technically a different
> question from yours. And now I'm
> getting more, because of your disrespect.
>
>
> > But it is ok. It is usually being studied at some university courses, so
> if you decide to enter some high
> > education school you will learn all of these things.
>
> You are in no position to say that. We are well educated, and apparently
> you are not such a person.
>
>
> --
> Best regards,
> LIU Hao
>
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.