> 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.
Theoretically, yes, I agree with you.

But in reality, many programmers don’t know all the details of the language 
standard and writing problematic code, that’s one of the reasons the compiler 
issues different warnings to the users in order to avoid those issues. 

In addition to this, Standards have been changed from time to time.

The code previously worked now has some issue since we added some new stuff 
into standard, and the compiler added some new transformation based on this new 
stuff. Should the compiler issue some warnings to warn the users about such 
change? Then the user will go to the new standard to get more info? 

Qing

> 
> 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.
> 
> Jeff

Reply via email to