A: a new bug to old plain C
Александр Поваляев
apovalyaev@gmail.com
Wed Nov 26 10:12:46 GMT 2025
[[[Below]]]...
ср, 26 нояб. 2025 г. в 13:05, LIU Hao <lh_mouse@126.com>:
> 在 2025-11-26 17:57, Александр Поваляев 写道:
> > Your mentioned the following text snippet from C standard:
> > "
> > 6.7.4 Type qualifiers
> > 6.7.4.1 General
> >
> > 11 For two qualified types to be compatible, both shall have
> >>>>>>> the
> > identically qualified version <<<<<<< of a compatible type; the
> order of
> > type qualifiers within a list of specifiers or qualifiers does
> not affect the
> > specified type.
> > ".
> >
> > So, the last code sample does a conversion between "non compatible"
> types without any error or warning.
> >
>
> Those types are not compatible. => This is correct.
>
[[[Aleksandr]]] So these types are not compatible. But the assignment goes
without any error or warning.
>
> But the conversion is allowed by the second quoted paragraph. Although
> those pointers point to
> incompatible types, the conversion happens as a simple assignment, so
> qualified compatible types are also
> allowed. (The left operand can't have fewer qualifiers than the right
> operand.)
>
> [[[Aleksandr]]] What particular citation do you mean?
[[[Aleksandr]]] Also. An important point to be mentioned: "Foo**"->"const
Foo * const * const" conversion being compiled with
"-Wno-incompatible-pointer-types"
still produce an error :(
> Best regards,
> LIU Hao
>
More information about the Gcc-help
mailing list