News for hackers. Stuff that matters.
Re:The Dangers of Super Smart Compilers by rwmj on Sunday December 20, 2015 @02:53PM (#10768065)
Surely the compiler could see that you've written some code (ie. not a macro expansion or whatever) and that the code is unreachable, and print some sort of dead code warning? That would have helped the poster, assuming he turns on and reads warnings.
Re:The Dangers of Super Smart Compilers by scott_s on Sunday December 20, 2015 @03:31PM (#10768192)
C and C++ applications include lots and lots of headers from the systems and third party libraries. Dead code is common in such circumstances, and programmers would drown in a sea of dead code eliminated warnings.
Re:The Dangers of Super Smart Compilers by rwmj on Monday December 21, 2015 @05:20AM (#10770439)
But you can still see: is the source of this code something the user has written in a .c file, or something that came from a header file or from macro expansion, and only warn about the former. Granted this is difficult, because LLVM is multi-layered, but it's not impossible in the general case.
Re:The Dangers of Super Smart Compilers by scott_s on Monday December 21, 2015 @10:37AM (#10771527)
I think it's extremely difficult, to the point of not being practical. When you get to the point of the compiler that it's applying these optimizations, that the code came from a .c or .h file has been long thrown away.