Quantcast
Channel: Question and Answer » assembly
Viewing all articles
Browse latest Browse all 23

Why was the AT&T assembly syntax designed this way?

$
0
0

The AT&T assembly syntax, often called the GAS syntax, keeps surprising me. For example, its parameter order:

mov $100,%eax /* Destination after source */

This just seems so counter-intuitive! Nearly all programming languages (and the good old mathematical notation) go the other way around: destination before source, like this:

int a = 100;   /* Destination before source (C-style) */
a := 100       // Destination before source (Pascal-style)
mov eax,100    ;  Destination before source (Intel assembly syntax)

There are other points, for example, sigils… The %-s before every register and the $ before every constant literal (except for those used as the fourth operand in the very strange-looking effective addressing syntax) mightily clutter up the code, when it would have been trivial to avoid them. What is, or was, their advantage?


Viewing all articles
Browse latest Browse all 23

Trending Articles