Low-Level Coding

I have always been an advocate of programmers knowing how things work under the hood. There are lots of reasons for this, and lots of examples of others thinking the same thing. Most CS schools offer (require?) a course in compiler design, for example, so that students get a feel for what goes on under the hood of a programming language. Raymond Chen mentions that he does most of his debugging in assembly language, and Larry Osterman says the same thing. I’ve long had a habit of having coders that work for me learn x86 assembly if they didn’t know it already, and I prefer to hire people who do.

While assembly is near and dear to my heart, there are other low-level topics that I have hardly given a second thought to over my career, one of which is the Hell of Floating Point Math. However, I just took the time out to read Eric Lippert’s five-part series on Fun With Floating-Point Arithmetic. It’s well-written and worth a read, even if you don’t usually don’t run into floating point math (and particularly if you don’t).

Another of my favorite resources is DataRescue’s fabulous Interactive Disassembler, commonly known as IDA. It’s really one of the tools that I’ve come to rely on to get an idea of what happens to my nice, tidy (riiiight…) C code once cl.exe is done with it. Although the same thing can be accomplished with WinDBG, using IDA to examine your code (or someone else’s!) is much easier, due to the fact that it can properly handle C-style constructs such as structs, unions, switch statements, etc. You can also supply names for variables, which provides a major help in understanding what’s going on. I have no commercial interest in IDA, for what that’s worth.

2 Replies to “Low-Level Coding”

Leave a Reply to sh Cancel reply

Your email address will not be published. Required fields are marked *