3 ms·
What's wrong is that the code is being generated, shown, pushed to repository, and distributed (for the purpose of human editing). With a compiler, the binary o
by hzhou321 5y ago
What's wrong is that the code is being generated, shown, pushed to repository, and distributed (for the purpose of human editing). With a compiler, the binary output is not shown, not maintained. The source code is. The generated code is no longer source code. Giving it an appearance of source code and even distributed as source code, is wrong.
The source code for the mentioned example is:
...
[copy linked list: annotations]
...
I am not saying that the compiled/generated output shouldn't be human readable -- I strongly support readable intermediate outputs. But we need always recognize what is the real source code and what is the tool. Confusing them inflates the complexity and promotes wrong attitude, such as not taking responsibility for one's code or not caring about understanding the code.
- gravypod 5y ago> The generated code is no longer source code. Giving it an appearance of source code and even distributed as source code, is wrong. Yes, exactly.
- amw-zero 5y agothis did occur to me while reading the post - why not just generate assembly from the specifications? What's the point of the intermediate translation to C?
- hzhou321 5y agoSo each tool can stack on top of another tool.
- curryst 5y agoAssembly is specific to the architecture, potentially in non-trivial ways. They either have to manually write support for each CPU architecture, or they need a higher level abstraction language. C is basically that higher level abstraction language. The tooling also helps. C compilers do some pretty fancy optimizations. Again, they can either re-implement that inside their tool, or they can just output C and use the existing tools.