Live data from Hacker News

No one should use the AT&T syntax (2021)

outerproduct.net

21–30 of 112 posts

Re: No one should use the AT&T syntax (2021)

#22

> ...you should still clean your CPU at least annually: use soap, warm water, and a soft rag to get the gunk out of the transistors. I know the author is just making a joke here, and it is funny. Somehow it reminded me of some actual advice I've seen more than once on /r/thinkpad. I am paraphrasing from memory, but I'm sure I have the gist of it: > When you get a brand new ThinkPad in a factory sealed box, the first…

Reminds me of a little quip in a 68000 programming language book I read a long time ago.

Paraphrasing: "Upon executing HALT, the processor will stop, and nothing short of a reset will get it going again. Although threatening it with a hammer has been known to work on occasion, especially if it knows you've killed before."

Re: No one should use the AT&T syntax (2021)

#25
post #17

As someone who has both written and read a lot of assembly in a professional context, my colleagues who are assembly writers very frequently prefer Intel syntax. The ones who are mostly (exclusively) readers seem to generally prefer AT&T. It is pretty undisputed that AT&T is easier for computers to parse, but it's also generally easier for humans to parse when reading it. * The suffixes give you a lot of easy specifi…

> Operand order in AT&T is really dumb I always found AT&T order much more intuitive to read. The "what am I doing" and then "where will it go" felt natural to me. But I didn't do much assembler, so my opinion doesn't matter :)

If you write for any CPU other than an x86, the Intel assembler syntax matches the syntax order you would get. It also sort of lines up with C and C++ syntax of putting the result on the left.

I might be biased as an Intel-syntax-loving assembly-writing heathen.

Re: No one should use the AT&T syntax (2021)

#26
post #4

I didn't really read the article, because/but I spent a minute or two playing with the cat. Nice little animation.

It used to be known as Oneko or Xneko, and chase your Windows or X11 desktop cursor. I once used it on both.

Forcing it as a high-contrast distraction upon people who just want to read an article seems like it will discourage some of them.

Discouraged people who nevertheless want to read the article, while using their pointing device to scroll, could add this to their uBlock Origin "My filters" tab:

    ||outerproduct.net/oneko.js$important

Re: No one should use the AT&T syntax (2021)

#27

> ...you should still clean your CPU at least annually: use soap, warm water, and a soft rag to get the gunk out of the transistors. I know the author is just making a joke here, and it is funny. Somehow it reminded me of some actual advice I've seen more than once on /r/thinkpad. I am paraphrasing from memory, but I'm sure I have the gist of it: > When you get a brand new ThinkPad in a factory sealed box, the first…

tangentially reminds me of the advice for waterproofing an outdoors electronics enclosure. use a waterproof enclosure, make sure the seal is properly placed, and intact, seal everything up and drill a hole in the bottom to let the water out.

Re: No one should use the AT&T syntax (2021)

#28
> mov eax, ebx ; (1) load one dword from the EBX register and store it in the EAX register

This is a mov instruction, not a ld instruction.

There is no loading going on. The value in EBX is already loaded. Otherwise it wouldn't be in a register.

It's hard for me to take someone seriously who doesn't understand the difference between a load and a move but feels as if they have the right to an opinion about assembly.

Re: No one should use the AT&T syntax (2021)

#29

> Putting the destination operand first emphasizes the site of mutation. This doesn't make any more convincing an argument than the "linguistic" and "consistency" arguments he shot down earlier. Why should putting the mutated argument first emphasize it any more than putting it second? If you order things the same way every time, people will implicitly know which one is the mutated argument because that's how the lan…

I think because it's always in the same place and always first. That definitely emphasises it.

Personally I think assembly should just have a little more syntax. If we wrote

  dst = mv src
or

  dst 
it would just be obvious.

Re: No one should use the AT&T syntax (2021)

#30

> Putting the destination operand first emphasizes the site of mutation. This doesn't make any more convincing an argument than the "linguistic" and "consistency" arguments he shot down earlier. Why should putting the mutated argument first emphasize it any more than putting it second? If you order things the same way every time, people will implicitly know which one is the mutated argument because that's how the lan…

I'd agree that there is no strong inherent benefit to either ordering, except that it would be good not to needlessly violate expectations about mathematical operations. AT&T also permutes the order of operands of comparisons, which is just bizarre: https://gcc.godbolt.org/z/h6EcP5Yv9

"Compare A and B and do X if result is 'less than'" should never mean "do X if B is less than A".

Anyway, the most important consideration for me is that standard documentation uses Intel operand order. Intel's manuals are hard enough to read, I wouldn't want to additionally permute operands in my head.

Post reply on HN