ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I prefer gas syntax despite learning Intel syntax and writing a lot of code in Intel syntax long before learning gas syntax.
Switching between two operand orders is confusing. Neither order is inherently more or less confusing.
I'm not thrilled with the % or many other ways that gas syntax tries to be more machine independent than an assembler can actually be.
But typed and sized memory reference operands are just so wrong for the concept of assembler programming that they overwhelm everything else.
When the assembler can't deduce the size or type of an operand from the register choice or instruction or other local info, that info should be provided as a suffix to the opcode. Anything else is just wrong. The Intel method of defining type and size info for memory addresses is a bad way of pretending that asm is a high level language. If you want to program in C, program in C. If you want to program in asm, a name defined for an address should just represent an address, not an address type and size.
Personally I find the destination-first syntax easier to understand, maybe because I'm used to C, and because in mov instructions, for example, I can at a glance see what the register/memory location is set to by looking at the end of the line.
Also I find typing those awkwardly-placed '%' and '$' characters so often very difficult, and with time maybe a bit painful. I also think they add a lot of "visual noise", severely reducing the code's readability.
And I find that [] is more intuitive than () for dereferencing for me, again because I am used to C. But I don't really care, this is more of a little thing.
But OTOH I really like AT&T Syntax's size suffixes. You're right that it is a little wrong for the assembler to remember the types and sizes of "variables".
@smeezekitty
Wouldn't it be great if there would be an assenbly language with instruction suffixes, destination-first operator order, and no symbols before registers/literals?
Personally I find the destination-first syntax easier to understand, maybe because I'm used to C, and because in mov instructions, for example, I can at a glance see what the register/memory location is set to by looking at the end of the line.
Also I find typing those awkwardly-placed '%' and '$' characters so often very difficult, and with time maybe a bit painful. I also think they add a lot of "visual noise", severely reducing the code's readability.
And I find that [] is more intuitive than () for dereferencing for me, again because I am used to C. But I don't really care, this is more of a little thing.
But OTOH I really like AT&T Syntax's size suffixes. You're right that it is a little wrong for the assembler to remember the types and sizes of "variables".
@smeezekitty
Wouldn't it be great if there would be an assenbly language with instruction suffixes, destination-first operator order, and no symbols before registers/literals?
Assembly syntax is a non-issue nowadays. One typically writes in assembly only reset routine and ISRs which comprise a very small part of the code present in a system.
Complaining about assembly syntax doesn't mane sense in the presence of languages like Perl/Python/etc - one can write a layer of assembly text generating subs in them and choose for the subs the desired order of operands (src, dst, whatever else).
Or just plain parser that would accept the desired assembly syntax.
I wonder what ASM syntax do you think is better? Here's the way I see it:
Intel Syntax
Good:
Intuitive operator order (dest, source)
AT&T Syntax
...
Bad:
Confusing operator order (source, dest)
Hmm. I think the AT&T order (source, dest) is more intuitive. I can see where your coming from, if you treat it like an assignment operator in higher-level languages, but I don't treat it that way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.