Live data from Hacker News

AT&T Syntax versus Intel Syntax (2001)

cs.mcgill.ca

101–110 of 112 posts

Re: AT&T Syntax versus Intel Syntax (2001)

#101
post #85

Earlier quoted context omitted.

It's even more confusing if moves have a different operation order from arithmetic ops and comparisons, no?

No, each should have what makes sense, whether analogous to math or a shell command.

This implies that dst<-src "doesn't make sense"; but then why does practically every programming language use this ordering?

Re: AT&T Syntax versus Intel Syntax (2001)

#102
post #78

Earlier quoted context omitted.

The amount of disagreement this individual testimony is generating is fascinating and frustrating to me. I didn’t think it ever really makes sense to disagree with a comment like this, unless one is claiming that the content of your comment is intentionally untrue. Anyways, appreciate your perspective.

It's rare that I post unpopular opinions, but when I see an HN thread full of people talking about how terrible the tools are which helped me be successful, I just can't help but speak up. It's an important topic for me because I originally believed the consensus. Like all of you, I read the countless Internet comments which say things like GNU AS is meant only as a backend for GCC, that you must never write assembly…

I don't think much hate is directed at the tools per say, but rather it's at the syntax. It's like how people complain about all the idiosyncrasies of English, without denying it's an important, useful language.

As Stroustrup put it: “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”

Re: AT&T Syntax versus Intel Syntax (2001)

#103

Earlier quoted context omitted.

The line between syntax and functionality is pretty thin for an assembler. I've definitely had code that some assemblers accepted and others didn't on the same arch, so even if they could be equally expressive in practice they aren't. Fairly sure that's also true of inline assembly on clang x64, had to change between intel and at&t for something a while ago.

Not really. Intel vs AT&T syntax is about how to generate machine code from mnemonics. Cooperation with the linker comes with other directives and options. gas has tight cooperation with GNU ld via directives (which mostly are just implemented with ELF constructs AFAIK), not instruction syntax. It can actually be set to accept either AT&T or Intel syntax, without losing any support for other features.

The case that comes to mind was emitting a (correct) relocation for one mode and raising an error for the other. That was more likely to be llvm-mc than gas though, so results from on assembler may not apply to all assemblers.

Re: AT&T Syntax versus Intel Syntax (2001)

#104

In grade school, they showed us a movie where researchers attached special glasses to a volunteer, and the volunteer had to wear them 24/7 or a mask for sleeping. The glasses turned everything upside down. After a few days, suddenly everything was right side up for the volunteer. Until he took the glasses off ... The movie ended with a warning to never try this yourself. Anyhow, I'm reminded of that movie every time…

> glasses turned everything upside down

https://www.madsci.org/posts/archives/mar97/858984531.Ns.r.h...

"""

[...] first investigated by George Stratton in the 1890 s

[...] he ran another experiment where he wore it for eight days in a row. On the fourth day, things seemed to be upright rather than inverted. On the fifth day, he was able to walk around his house fairly normally but he found that if he looked at objects very carefully, they again seemed to be inverted. On the whole, Stratton reported that his environment never really felt normal especially his body parts, although it was difficult to describe exactly how he felt. He also found that after removing the reversing lenses, it took several hours for his vision to return to normal.

[...]

"""

Re: AT&T Syntax versus Intel Syntax (2001)

#105

Earlier quoted context omitted.

Not really. Intel vs AT&T syntax is about how to generate machine code from mnemonics. Cooperation with the linker comes with other directives and options. gas has tight cooperation with GNU ld via directives (which mostly are just implemented with ELF constructs AFAIK), not instruction syntax. It can actually be set to accept either AT&T or Intel syntax, without losing any support for other features.

The case that comes to mind was emitting a (correct) relocation for one mode and raising an error for the other. That was more likely to be llvm-mc than gas though, so results from on assembler may not apply to all assemblers.

Emitting a relocation with .reloc directive? Definitely sounds like an llvm-as bug.

Re: AT&T Syntax versus Intel Syntax (2001)

#106

Earlier quoted context omitted.

The case that comes to mind was emitting a (correct) relocation for one mode and raising an error for the other. That was more likely to be llvm-mc than gas though, so results from on assembler may not apply to all assemblers.

Emitting a relocation with .reloc directive? Definitely sounds like an llvm-as bug.

No, it was an arithmetic expression related to labels. And yes I'd agree that it working in... I want to say intel and not at&t (might be the other way around) is a bug/missing feature. Didn't bother fixing or reporting it at the time though.

Re: AT&T Syntax versus Intel Syntax (2001)

#107

Earlier quoted context omitted.

No, each should have what makes sense, whether analogous to math or a shell command.

This implies that dst<-src "doesn't make sense"; but then why does practically every programming language use this ordering?

A minor historical mistake/misdesign around the equals sign. Looks like algebra but fundamentally different.

Re: AT&T Syntax versus Intel Syntax (2001)

#108

In grade school, they showed us a movie where researchers attached special glasses to a volunteer, and the volunteer had to wear them 24/7 or a mask for sleeping. The glasses turned everything upside down. After a few days, suddenly everything was right side up for the volunteer. Until he took the glasses off ... The movie ended with a warning to never try this yourself. Anyhow, I'm reminded of that movie every time…

> glasses turned everything upside down https://www.madsci.org/posts/archives/mar97/858984531.Ns.r.h... """ [...] first investigated by George Stratton in the 1890 s [...] he ran another experiment where he wore it for eight days in a row. On the fourth day, things seemed to be upright rather than inverted. On the fifth day, he was able to walk around his house fairly normally but he found that if he looked at object…

Thanks for the references. I saw the black&white film around 1967.

Re: AT&T Syntax versus Intel Syntax (2001)

#109
post #59
post #48

Earlier quoted context omitted.

Also the % before register names is completely unnecessary, it just another extra character to type.

It disambiguates labels from registers, assuming of course you allow labels to have register names. eg this is valid: mov rax,%rax rax: .ascii "hello\0" Stupid perhaps, but valid.

Yep, the "nice" thing about AT&T is that, from a parsing perspective, you don't really need to know much about the target architecture to be able to determine what's an instruction vs. a register vs. a label, etc.

Re: AT&T Syntax versus Intel Syntax (2001)

#110

Earlier quoted context omitted.

> glasses turned everything upside down https://www.madsci.org/posts/archives/mar97/858984531.Ns.r.h... """ [...] first investigated by George Stratton in the 1890 s [...] he ran another experiment where he wore it for eight days in a row. On the fourth day, things seemed to be upright rather than inverted. On the fifth day, he was able to walk around his house fairly normally but he found that if he looked at object…

Thanks for the references. I saw the black&white film around 1967.

You're welcome. I had heard the story before, but couldn't remember the attributed date, got curious and looked it up.
Post reply on HN