A bit of inspiration most weekdays for exploring your mindset .

Write code to compile

Khem Raj November 06, 2024 #meta

A lot of times we write the code and throw it at the compiler and see what it comes up with, if it complains, we try to silence the diagnostics, warnings are simply ignored, errors are worked with, at times they are workarounds with TODO in code doing just that. Once compiled, we take the binaries to target and execute them, if they run into problems, we throw a debugger and trace the code execution path until the error is hit we apply some other fixes to get by. A pointer is null, so we add a null check before accessing the content pointed by it. This gets rid of the segfault. These practices do work to some extent, but they cause issues too.

Remember compilers and debuggers are software programs too, they may have their own bugs and at times own extensions to language and common working processes. Lot of times there is undefined behavior in language specifications which may not be called out by compiler

Coding to the compiler is less than ideal, instead code the logic using language constructs and specifications, trace the logic with other means instead of debuggers. Use the tools but to do what they are intended to do. They are not the tools to teach how to program or design software.