> On Mar 21, 2023, at 1:59 PM, Jeff Law via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 3/21/23 11:00, Qing Zhao via Gcc-patches wrote:
>>> On Mar 21, 2023, at 12:56 PM, Paul Koning <paulkon...@comcast.net> wrote:
>>>
>>>
>>>
>>>> On Mar 21, 2023, at 11:01 AM, Qing Zhao via Gcc-patches
>>>> <gcc-patches@gcc.gnu.org> wrote:
>>>>
>>>> ...
>>>> Most of the compiler users are not familiar with language standards, or no
>>>> access to language standards. Without clearly documenting such warnings
>>>> along with the option explicitly, the users have not way to know such
>>>> potential impact.
>>>
>>> With modern highly optimized languages, not knowing the standard is going
>>> to get you in trouble. There was a wonderful paper from MIT a few years
>>> ago describing all the many ways C can bite you if you don't know the rules.
>> Yes, it’s better to know the details of languages standard. -:)
>> However, I don’t think that this is a realistic expectation to the compiler
>> users: to know all the details of a language standard.
> Umm, they really do need to know that stuff.
>
> If the developer fails to understand the language standard, then they're
> likely going to write code that is ultimately undefined or doesn't behave in
> they expect. How is the compiler supposed to guess what the developer
> originally intended? How should the compiler handle the case when two
> developers have different understandings of how a particular piece of code
> should work? In the end it's the language standard that defines how all this
> stuff should work.
>
> Failure to understand the language is a common problem and we do try to emit
> various diagnostics to help developers avoid writing non-conformant code.
> But ultimately if a developer fails to understand the language standard, then
> they're going to be surprised by the behavior of their code.
Conversely, of course, the problem is that C and other languages have evolved
to the point that you have to be a language lawyer to write valid code. In
other words, a substantial fraction of programmers are by definition writing
unreliable code. This is not a good situation, and it may be part of the
reason why modern software has such a high rate of defects.
paul