On 12/18/2011 2:09 AM, Walter Bright wrote:
A programmer who doesn't know assembler is never going to write better
than second rate programs.

I don't even know assembler that well and I agree 100%. I can read bits of assembler and recognize compiler optimizations and could probably mechanically translate C code to x86 assembler, but I'd be lost if asked to write anything more complicated than a small function from scratch or do anything without some reference material.

Even this basic level of knowledge has given me insights into language design. For example: I'd love to be asked in an interview whether default arguments to virtual functions are determined by the compile time or runtime type of the object. To someone who knows nothing about assembler this seems like the most off-the-wall language-lawyer minutiae imaginable. To someone who knows assembler, the answer is obviously the compile time type. Otherwise, you'd have to store the function's default arguments in the virtual function table somehow, then look each one up and push it onto the stack at the call site. This would get very hairy and inefficient very fast.

Reply via email to