Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The cryptic instruction names in assembly drive me nuts, too.

`integer_multiply_64bit` is much easier and faster for my eye to parse than `imulq`, which is a blob I have to stop and tease apart. I would also be fine with `imul_64` or `int_mul_64`; over time I could probably get used to `imul_q`.

But `imulq` jammed all together is a nope. I still hate `strrchr` and `atof` and all those silly names which parse poorly from the C standard library, and I've been programming C for many years.

I figure you could create a 1:1 assembly transpiler which does two things:

* Maps a bunch of aliases like `integer_multiply_64bit` to their official names.

* Uses parentheses, argument order, and dereferencing operators according to conventions which are more in line with what people are accustomed to seeing in popular modern programming languages.

Register naming seems a bit tougher, though, and I haven't figured out an approach for deriving intuitive aliases. Suggestions?

> “it’s not so bad. if you are smart like me, it’s easy”?

There are going to be responses that read like this, well-intentioned or no, but we just have to press on regardless.



The question is: why the effort to make assembly even more verbose?

People who write assembly (they still exist, I guess) will prefer "imulq" after a short time because it's much faster to type. Remember that a line like "a=2+b*f(x+1)" corresponds to 5 to 10 machine instructions.

People who have to read assembly don't really care because after a few minutes you know the mnemonics of the 20 most frequently used instructions (which constitute probably 99% of the code) anyway.

Computers that have to write or read a lot of assembly (some compilers do not directly generate binary machine code) are more efficient with a compact representation.

Okay, if we ignore the above cases, there are maybe five or six people in the world who might prefer "integer_signed_multiply_32bit" or "jump_relative_if_unsigned_less_or_equal".


> People who have to read assembly don't really care

I have to read assembly, and I do care. I'd much rather read something like imul.q than imulq. Assemblers could allow something like this by ignoring such periods or underscores, the same way that many modern programming languages allow you to write 1_000_000 as a synonym for 1000000.

Though a lenient assembler frontend wouldn't necessarily help me, since the assembly code I most often read is dumped by a disassembler I have no control over.


Any assembler worth using has macros so you can integer_multiply_64bit to your hearts content.


It's about the readability of existing code, not the writeability of new code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: