Live data from Hacker News

Rewrite Linux Kernel in Rust?

dominuscarnufex.github.io

11–20 of 133 posts

Re: Rewrite Linux Kernel in Rust?

#11
post #3

I wonder what makes AT&T assembly syntax "objectively crap".

You need to explicitly specify what the parameter sizes and types are. Plus, the parameters are backwards compared to Intel syntax: Intel: mov eax, 5 AT&T: movl $5, %eax In basically every C-like programming language, you assign 5 to eax with `eax=5` not `5=eax`. I can also tell that I'm working with the `long` variant of `mov` just by looking at the types involved. Intel's syntax for memory access seems more natural…

Makes you wonder why not write it as e.g. "eax mov 5" or even "eax = 5".

Re: Rewrite Linux Kernel in Rust?

#13
post #3

I wonder what makes AT&T assembly syntax "objectively crap".

You need to explicitly specify what the parameter sizes and types are. Plus, the parameters are backwards compared to Intel syntax: Intel: mov eax, 5 AT&T: movl $5, %eax In basically every C-like programming language, you assign 5 to eax with `eax=5` not `5=eax`. I can also tell that I'm working with the `long` variant of `mov` just by looking at the types involved. Intel's syntax for memory access seems more natural…

Right, but the mnemonic reads better in AT&T then "move 5 to register eax" and Intel seems backwards.

Re: Rewrite Linux Kernel in Rust?

#14
post #8

Earlier quoted context omitted.

You need to explicitly specify what the parameter sizes and types are. Plus, the parameters are backwards compared to Intel syntax: Intel: mov eax, 5 AT&T: movl $5, %eax In basically every C-like programming language, you assign 5 to eax with `eax=5` not `5=eax`. I can also tell that I'm working with the `long` variant of `mov` just by looking at the types involved. Intel's syntax for memory access seems more natural…

Interestingly, in the language you actually wrote that complaint in : > you assign 5 to eax AT&T speaks English, basically. We move A to B. Destination goes last. Both seem sane enough. And in fact both get really balled up when you have three and four-argument instructions.

I'll grant that, but it's a programming language, so I kind of expect it to follow the order assignment does when I write in C++, C#, etc.

Re: Rewrite Linux Kernel in Rust?

#17
post #8

Earlier quoted context omitted.

Interestingly, in the language you actually wrote that complaint in : > you assign 5 to eax AT&T speaks English, basically. We move A to B. Destination goes last. Both seem sane enough. And in fact both get really balled up when you have three and four-argument instructions.

I'll grant that, but it's a programming language, so I kind of expect it to follow the order assignment does when I write in C++, C#, etc.

AT&T assembly style significantly predates C++ (and C# by like two decades), and co-evolved with C. And strictly this isn't an assignment, anyway. Assignment is an abstract operation in a programming language. This is a machine instruction[1] for a physical machine, which does exactly one thing.

[1] Pause while the peanut gallery points out that in fact there are like ninety six different instructions in x86 called some variant of "MOV". Yeah, yeah, we know.

Post reply on HN