logoalt Hacker News

kragentoday at 6:51 AM1 replyview on HN

I don't think they're particularly less bad. All five architectures just treat memory as a single untyped array of integers, and registers as integer global variables. Their only control structure is goto (and conditional goto.) If you forget to pass an argument to a subroutine, or pass a pointer to an integer instead of the integer, or forget to save a callee-saved register you're using, or do a signed comparison on an unsigned integer, or deallocate memory and then keep using it, or omit or jump past the initialization of a local variable, conventional assemblers provide you no help at all in finding the bug. You'll have to figure it out by watching the program give you wrong answers, maybe single-stepping through it in a debugger.

There are various minor details of one architecture or the other that make them more or less bug-prone, but those are minor compared to what they have in common.

None of this is because the instruction sets are complex. It would be closer to the mark to say that it's because they are simple.


Replies

pjc50today at 11:27 AM

I have a postit note idea that says simply "typesafe macro assembler".

I've not fleshed this out yet, but I think a relatively simple system would help deal with all the issues you mention in the first paragraph while allowing escape hatches.

show 2 replies