News for hackers. Stuff that matters.
Re:AT&T Syntax versus Intel Syntax by bbarnett on Sunday November 13, 2022 @01:53PM (#33586125)
They are using a classic dollar sign for assignment, so clearly at&t is better.
Re:AT&T Syntax versus Intel Syntax by amluto on Sunday November 13, 2022 @02:20PM (#33586396)
Contemplate the AT&T vs Intel syntax for x86 addressing modes and say that again.
Re:AT&T Syntax versus Intel Syntax by ratsmack on Sunday November 13, 2022 @02:25PM (#33586436)
Re:AT&T Syntax versus Intel Syntax by amluto on Sunday November 13, 2022 @03:29PM (#33587009)
They are an atrocity in AT&T syntax. They are perfectly readable in Intel format. For example:

https://blog.yossarian.net/2020/06/13/How-x86_64-addresses-m...

Re:AT&T Syntax versus Intel Syntax by ratsmack on Sunday November 13, 2022 @03:46PM (#33587160)
That is an excellent write up, thanks.
Re:AT&T Syntax versus Intel Syntax by masklinn on Sunday November 13, 2022 @02:42PM (#33586574)
> They are using a classic dollar sign for assignment

They're using a dollar sign for immediates.

As if you can't notice that it's a number.

    addl $4, %eax
that's 3 different completely unnecessary symbols for things which are not ambiguous in the first place:

- the operation width is provided by the registry

- a number is an immediate

- a register is named

Hence the much less noisy Intel syntax:

    add eax, 4
Re:AT&T Syntax versus Intel Syntax by matja on Sunday November 13, 2022 @02:54PM (#33586673)
addl is not necessary if it is not ambiguous

    add $4, %eax
- is fine

Compare with

    add 4, %eax
The "less noisy" Intel syntax becomes:

    add eax, DWORD PTR [4]
Re:AT&T Syntax versus Intel Syntax by __init on Sunday November 13, 2022 @03:48PM (#33587181)
Most assemblers for Intel syntax will let you write:

    add eax, [4]
if you desire. Indeed, many disassemblers will follow suit in unambiguous cases. IDA, for example, does this.
Re:AT&T Syntax versus Intel Syntax by colejohnson66 on Sunday November 13, 2022 @05:03PM (#33587855)
This. The only time “DWORD PTR” is required is when (1) you’re working with old assemblers, or (2) you’re using a memory operand with an immediate:

    add eax, [4]       ; inferred
    add [eax], 4       ; ambiguous
    add DWORD [eax], 4 ; explicit
A disassembler may output it when not necessary, however.
Re:AT&T Syntax versus Intel Syntax by docandrew on Sunday November 13, 2022 @04:24PM (#33587491)
The comma is unnecessary too, so that’s 4 unneeded symbols.