On Fri, 19 May 2017 06:12 am, Chris Angelico wrote: > On Fri, May 19, 2017 at 5:29 AM, bartc <b...@freeuk.com> wrote: >> On 18/05/2017 19:50, Chris Angelico wrote: >> >>> Now this, however, is more serious. Those warnings scare me, too. (I >>> just tried it.) Instead of being "gcc is noisy", these are "your code >>> is sloppy". These are exactly why I tell most people NOT to write in >>> C. For machine-generated code, this is IMO unacceptable. Maybe >>> "-Wno-unused" is okay (machine-generated code often has some junk in >>> it), but all the uninitialized variables? No way. Doesn't matter what >>> compiler you use, run it in all-warnings-enabled mode at least once as >>> part of testing your codegen. >> >> >> The rules are different when you are writing in a different language and >> only use a C compiler to compile the intermediate code. > > Only if your codegen is magically perfect. What happens if you have a > bug in your compiler? What if it emits incorrect C code?
Oh but this is Bart we're talking about. Of course his code generator is perfect, it is unthinkable that it emits incorrect code. >> Before it becomes C, the code has already been largely verified. C might >> still pick up some things, if the first compiler doesn't check them. > > "largely" verified. Can you be absolutely certain that not one of > these compiler-detected issues is actually a problem? Would you stake > your life on it - for example, would you compile this code and put it > in charge of an airliner that you then ride on? > >> But C is dominated by its ideas of what is undefined behaviour and what >> is implementation defined, which don't match the model used in the >> original language. Since you are ultimately compiling the code in C, those ideas of undefined behaviour etc do apply. The behaviour of the C compiler doesn't suddenly, magically, change just because the code was generated by a program in another language. If <some code> generates warnings because it relies on undefined behaviour, it is still undefined behaviour regardless of whether you typed the code yourself or used a code generator. -- Steve Emoji: a small, fuzzy, indistinct picture used to replace a clear and perfectly comprehensible word. -- https://mail.python.org/mailman/listinfo/python-list