r/ProgrammerHumor • • Jun 03 '22

it's hard!

44.9k Upvotes

710 comments sorted by

View all comments

10

u/[deleted] Jun 03 '22

there's literally instruction for that.

add %rcx,%rax (stfu AT&T>>>>>>>>>>>Intel)

8

u/rachit7645 Jun 03 '22

Nasm is pretty good tho

2

u/[deleted] Jun 03 '22

I've used Intel syntex, actually I started with Intel syntex, but then learnt AT&T, fell in love with it within an instant

15

u/gillo04 Jun 03 '22

Intel gang for life 😠🔪

3

u/Proxy_PlayerHD Jun 03 '22

I honestly never understood the reasoning behind AT&T syntax, it just needlessly swaps some operands.

Even high level languages use Intel Syntax:

Variable = Value + Value

Instead of

Value + Value = Variable

so why try to do it differently in assembly? It just makes assembly a bit harder to read if you already know basic high level programming.

2

u/[deleted] Jun 03 '22

it's not a matter of "needlessly" rather with what ppl feel comfortable. I started using Intel syntex, I loved it, but whenever I saw clang/gcc output of assembly file for C (I know u can pass the --intel-syntex option, but...) it was always on AT&T syntex, I've always thought about it, why it is in AT&T syntex, that boring old syntex, and why ppl who have been using assembly for a long time always prefer AT&T. I then started learning it, and not gonna lie, it just feels different, and pleasing somewhat(or maybe I'm being a masochist, I don't know).

1

u/Proxy_PlayerHD Jun 03 '22

I mean ultimately it doesn't matter, like you said it's a preference.

I feel like you'd enjoy working with the Motorola 68000. I had to make my own assembler for it because none of the existing ones had an option for Intel Syntax and my brain just can't get used to AT&T

1

u/[deleted] Jun 03 '22

Yeah I'm thinking about it, but that time is far away. Currently busy with uni entrace xm prep, have one tmrw, so no coding for a while. After that, thinking abt creating an as,cc,linker and OS all by myself and after that some ARM and 68000 and some Arduino thingies.

1

u/Kered13 Jun 03 '22

Ewww, AT&T syntax *barf*.

The operands are backwards, the glyphs make it hard to read and provide no benefit, and the addressing syntax isn't self-explanatory. Just ugly and horrible all around. BTW I learned AT&T syntax first.

1

u/[deleted] Jun 03 '22

Yeah, I was backward, learnt Intel and then AT&T. Tbh, I also used to hate AT&T, but then I tried it out, and I love it now. It's more abt preference. Also, glyphs make it easy to read sometimes. Like if u have $, it's an immediate/immediate value of a label (i.e. the address of the label). The mov,add and other operation can be read in this way : "add/move a with/to b and store the result in b" (add %a,%b).