In the end it all boils to a very simple argument. The C programmers want the C compilers to behave one way, the C implementers want the C compilers to behave the other way. Since the power structure is what it is — the C implementers are the ones who write the C standard and are the ones who actually get to implement the C compilers — the C compilers do, and will, behave the way the C implementers want them to. In t…
> behave the way the C implementers want them to If you don't please your users, you won't have any users.
What every compiler writer should know about programmers (2015) [pdf]
11–20 of 101 posts
Re: What every compiler writer should know about programmers (2015) [pdf]
#12The only dead code is generated code by macros.
Re: What every compiler writer should know about programmers (2015) [pdf]
#13Here's a cogent argument that any decision by compiler writers that they can do whatever they wish whenever they encounter an "undefined behavior" construct is rubbish: https://www.yodaiken.com/2021/05/19/undefined-behavior-in-c-... And here's a cautionary tale of how a compiler writer doing whatever they wish once they encounter undefined behavior makes debugging intractable: https://www.quora.com/What-is-the-most-s…
Wow, that's a very torturous reading of a specific line in a standard. And it doesn't really matter what Yodaiken thinks this line means because standard is written by C implementers for (mostly) C implementers. So if C compile writers think this line means they can use UB for optimizing purposes, then that's what it means. Yeah, I know it breaks the common illusion among the C programmers that they're "close to the…
Re: What every compiler writer should know about programmers (2015) [pdf]
#14This was 2015, and we still have no -Wdeadcode, warning of removal of "dead code", ie what compilers think of dead code. If a program writer writes code, it is never dead. It is written. It had purpose. If the compiler thinks this is wrong, it needs to warn about it. The only dead code is generated code by macros.
Re: What every compiler writer should know about programmers (2015) [pdf]
#15This was 2015, and we still have no -Wdeadcode, warning of removal of "dead code", ie what compilers think of dead code. If a program writer writes code, it is never dead. It is written. It had purpose. If the compiler thinks this is wrong, it needs to warn about it. The only dead code is generated code by macros.
Dead code is extremely common in C or C++ after inlining, other optimizations.
Re: What every compiler writer should know about programmers (2015) [pdf]
#16This was 2015, and we still have no -Wdeadcode, warning of removal of "dead code", ie what compilers think of dead code. If a program writer writes code, it is never dead. It is written. It had purpose. If the compiler thinks this is wrong, it needs to warn about it. The only dead code is generated code by macros.
Dead code is extremely common in C or C++ after inlining, other optimizations.
Re: What every compiler writer should know about programmers (2015) [pdf]
#17In the end it all boils to a very simple argument. The C programmers want the C compilers to behave one way, the C implementers want the C compilers to behave the other way. Since the power structure is what it is — the C implementers are the ones who write the C standard and are the ones who actually get to implement the C compilers — the C compilers do, and will, behave the way the C implementers want them to. In t…
How about we agree on the ABI and everyone can have their own C compiler. Everyone C's the world through their own lenses.
Re: What every compiler writer should know about programmers (2015) [pdf]
#18Making C compilers better and more predictable is impossible with so many UB cases listed in the standard. A better language should be used instead, where UB and implementation-defined behavior cases are minimized.
Re: What every compiler writer should know about programmers (2015) [pdf]
#19Here's a cogent argument that any decision by compiler writers that they can do whatever they wish whenever they encounter an "undefined behavior" construct is rubbish: https://www.yodaiken.com/2021/05/19/undefined-behavior-in-c-... And here's a cautionary tale of how a compiler writer doing whatever they wish once they encounter undefined behavior makes debugging intractable: https://www.quora.com/What-is-the-most-s…
By their own admission, the compiler warns about the UB. "-Wanal"¹, as some call it, makes it an error. Under UBSan the program aborts with:
code.cpp:4:6: runtime error: execution reached the end of a value-returning function without returning a value
… "intractable"?¹a humorous name for -Wextra -Wall -Werror
Re: What every compiler writer should know about programmers (2015) [pdf]
#20This was 2015, and we still have no -Wdeadcode, warning of removal of "dead code", ie what compilers think of dead code. If a program writer writes code, it is never dead. It is written. It had purpose. If the compiler thinks this is wrong, it needs to warn about it. The only dead code is generated code by macros.
Dead code is extremely common in C or C++ after inlining, other optimizations.