AT&T Syntax - Why?!?

Does anyone have some idea why stupid ugly AT&T syntax is used in UNIX C? (except for lazyness of compiler-writers). I can't see any pros of this syntax (except extremely easy compilation). It tries to be kind-of portable, but isn't and it makes hell to write.

i think, it is because of hystoric ages: once upon a time unix was based on other processors, where syntaxis was similar to the current at&t, and, when it was ported to the intel platform, programmers decided to adopt intel mnemonics to their customs instead change own. so, i would say more soft - it is "not usual" to those, who was started from intel basic - who knows about other, who started from pdp or motorola cpus, etc.

Re: AT&T Syntax - Why?!?

vid wrote:

Does anyone have some idea why stupid ugly AT&T syntax is used in UNIX C? (except for lazyness of compiler-writers). I can't see any pros of this syntax (except extremely easy compilation). It tries to be kind-of portable, but isn't and it makes hell to write.

PS: I am forced to use it in school project... ugh

i really dislike the syntax aswell, probably why i never used GCC for anything and always used LCC, but now i think most UNIX C compilers support intel syntax (i know gcc does)

Re: AT&T Syntax - Why?!?

vid wrote:

... stupid ugly AT&T syntax is ... hell to write.

and very difficult to read, no doubt...
however,
It should be noted, dear Vid, that the rest of the world, not just all other cpu programmers, but even people sending mail, specify:
SOURCE, DESTINATION.
In fact, from a HISTORICAL perspective, it is INTEL that has botched it up, not Motorola et al
But for IBM marketing prowress, selecting M$ over more competent alternatives, and choosing Intel to avoid looking like homo sapiens, we would all be writing that "stupid" syntax that you so dislike!
For me, reading Intel code is just that. Code.
It is an illogical architecture, with only ONE redeeming feature: it is accepted universally throughout the commercial world.
Tragic: yes. Stupid, no, I don't agree. Mind you, I ALSO dislike the ATT syntax, but not because it presents Assembly in a logical fashion (i.e. conformant with ALL other assemblers.) I dislike it because it differs from Intel's. If that seems contradictory, it may be. I don't like INTEL's cpu, but if I have to use it for some project, then I want to use an assembler that conforms to the Intel manual, rather than conforming to the Motorola architecture, superior though that architecture ALWAYS has been.....

Re: AT&T Syntax - Why?!?

tom tobias wrote:

vid wrote:

... stupid ugly AT&T syntax is ... hell to write.

and very difficult to read, no doubt...
however,
It should be noted, dear Vid, that the rest of the world, not just all other cpu programmers, but even people sending mail, specify:
SOURCE, DESTINATION.
In fact, from a HISTORICAL perspective, it is INTEL that has botched it up, not Motorola et al
But for IBM marketing prowress, selecting M$ over more competent alternatives, and choosing Intel to avoid looking like homo sapiens, we would all be writing that "stupid" syntax that you so dislike!
For me, reading Intel code is just that. Code.
It is an illogical architecture, with only ONE redeeming feature: it is accepted universally throughout the commercial world.
Tragic: yes. Stupid, no, I don't agree. Mind you, I ALSO dislike the ATT syntax, but not because it presents Assembly in a logical fashion (i.e. conformant with ALL other assemblers.) I dislike it because it differs from Intel's. If that seems contradictory, it may be. I don't like INTEL's cpu, but if I have to use it for some project, then I want to use an assembler that conforms to the Intel manual, rather than conforming to the Motorola architecture, superior though that architecture ALWAYS has been.....

good thing we all aren't writing that crappy syntax, as logical as it may be

i am not biased towards non-intel/amd x86 assemblers, i find ARM to be quite nice as far as assembly goes, for me it's not because it differs from intel, but because it is similar but in a worse way

Unfortunately tomtobias is wrong here. Intel got it right from the first try...all other did a big mistake. We are lucky. Think about it honestly, if you can not understand it alone... then i will explain a little:

Registers are like variables, We do write x = 5;
So it is only logical to also write eax = 5; only that in ASM "=" is more like "a move" ... hence the notation MOV EAX,5 perfectly corect and logically clear.

You must understand that ASM is a low level language and it is supposed to expose arhitectural and hardware related issues.

About GAS and AT&T syntax it was designed to be sytupid on purpose. It was never intended to write ASM applications in it.

Instead it was designed to ease the code generation from gcc and to ease the parsing of the GAS assembler as a backend for C compilers.

Hence the notation helps parsing by prefixing constnts and registers and uses the source, destination because it is easyer to generate code from it.

BTW the memory layout (Intel versus Motorola) is also corect in Intel and very wrong in Motorola

Re: AT&T Syntax - Why?!?

tom tobias wrote:

It is an illogical architecture, with only ONE redeeming feature: it is accepted universally throughout the commercial world.

Not quite, I think it's the most logical LOW-LEVEL architecture I have seen (maybe there are others I didn't see). You see.. it depends on what you call logic. What you learnt and what you know? It's not that surprising you find other (human) languages illogical. That's why you like english so much, because you know it, and everything you don't know (or don't like) you claim it's illogical/horrible syntax/etc.

If you don't like the Intel architecture, you are by no means forced to use/understand it's low-level logic, but why do you critique it? Build/design something yourself from scratch (that's it: from scratch because you're so afraid of starting things from scratch, I simply don't know why, perhaps because your such a lazy guy that wants to copy/paste everything), and then claim something is sh*t or illogical. Like I said, you're not forced to use or understand it if you don't like it. What I don't like about you is that you start to claim something is illogical, or claim it's horrible/etc simply because you don't like/understand it, or you think it's illogical from your perspective. But don't take your words as if you're the perfect being who IS RIGHT.

And about AT&T: I never really liked that syntax, it's not meant to be programmed by humans (especially for big projects), but rather for compilers/parsers, to make it easier for them.

AT&T syntax looks like the old 68000(68k) processor way of programming, it's one of the problems I had to overcome when switching from the mac/Amiga assembly programming to the pentium. The AT&T syntax is the ugliest style of pentium assembly that I have ever seen, hopefully this has changed in the latest GCC incarnations.

Unfortunately tomtobias is wrong here. Intel got it right from the first try...all other did a big mistake. ...
Registers are like variables, We do write x = 5;
So it is only logical to also write eax = 5; only that in ASM "=" is more like "a move" ... hence the notation MOV EAX,5 perfectly corect and logically clear.
...

yes, I may have erred in several ways. It may be as logical (for everyone else) to write ...destination-->source. I would not write:
please move shelves, books. I would write: please move [the] books to [the] shelves. I would not say or write: I wish to travel to London, departing from Paris. I would employ source then destination. I would not write: 7 = 4 + 3. I would write: 4+3 = 7. So, yes, I agree with Bogdan, wrong perhaps am I. Thinking aberrant my is maybe.
I am sure that Revolution is also correct. I used (as always) too much jalapeno (hyperbole) in preparing this dish. I should not have written ALL other assemblers, or even MOST other assemblers. I should have written mainstream assemblers. I am eager to learn from Bodgan or anyone else, why writing destination prior to source "expose(s) arhitectural and hardware related issues", while writing source, then destination does not reveal architectural or hardware related matters. Does Bogdan wish to imply that the 68020 and VAX assembers DO NOT reveal the same [low] level of hardware detail as Intel's various assemblers? I will be very eager to learn from someone how "all other did a big mistake." Where is the big error, Bogdan? Do you mean that all other assemblers since Intel's own (very primitive) assembler? Or, do you mean that Intel's architecture, with segments, and "protected mode" are superior to the VAX architecture???????
I couldn't disagree more. For me, VAX architecture was the standard, "best of breed". Motorola copied it. Intel did not.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum