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 have an opportunity to take an assembly programming class and wanted to read opinions about its future use among all these "powerful" high levels languages. (I'm clear that assembly is not one language)
I'm new to programming. Been playing with C and Python for 2 months.
Does anyone do work in assembly exclusively, possibly mixed in with C?
Learning assembly will teach you about the registers specific to x86 processors and the operations built-in to the processor. If nothing else, it will give you a different perspective on higher-level languages and an appreciation of language features such as loops and branching statements. If you intend to work in assembler on Linux consider reading http://www.faqs.org/docs/Linux-HOWTO...bly-HOWTO.html.
Does anyone do work in assembly exclusively, possibly mixed in with C?
Would anyone recommend learning assembly??
I had many years of coding primarily in assembly. In recent years I have done near zero (not quite zero) assembly coding. I'm sure there are still a few people who work exclusively in assembly, but very few, especially few for desktop and larger systems (as opposed to embedded).
However, I still use my knowledge of assembly almost every day while working with C++.
1) Debugging: There are lots of flaws in all the debuggers I have available and even more flaws when I must debug optimized code (which for various reasons is fairly often). I always debug with one window on the source code and one on the assembly. That way I always know whether any strange behavior I see is really in the program being debugged or is in the operation of the debugger.
2) Understanding obscure bugs: I work with heavily templated, very complicated code. Some of the bugs are too tricky to ever understand looking at just the C++ source code and the results (even single stepped intermediate value results in a debugger). I only really understand what is happening when I step through the asm code.
C++ is complicated enough that in those few cases where the bug is in the compiler, not the C++ code, it is almost impossible to figure that out without understanding the asm code generated.
3) Optimizing code: An ordinary C++ programmer has a very hard time predicting or even understanding which constructs in his C++ code will run optimally vs. those that waste CPU time. When performance really matters, you need to have experience looking at the asm code the compiler generates in order to write code that will run fast.
I learned assembly language for a few different CPUs before I learned C. I think that made me understand what the C language is all about, and learning it felt about as natural as anything I've ever learned in computing. It seems reasonable that you might benefit in the same way. As a productive tool, assembly language will forever be a niche language, in my opinion. There was a day when it was good for writing complete programs, but not any more except for embedded systems on small CPU's and maybe for the odd low-level components in device drivers for bigger machines.
--- rod.
Whenever a group of hardware engineers sets out to design "an altogether new processor" (which isn't too often, these days...) they spend a lot of time pondering how to design an efficient hardware architecture that will prove itself capable of meeting the demands of modern software without generating too much heat.
Meanwhile... as a software engineer, you simply want "the screen to look exactly the same as it does on a Windows machine, as it does when it is seen on this iPhone."
The assembly-language programmer is where these two points-of-view meet, but only on a single set of hardware.
It is, therefore, extremely useful to have acquired an in-depth knowledge of the hardware of any computer ... x86 or otherwise ... so that you might understand first-hand what sort of "issues" arise when "these two points-of-view meet."
But... "is this 'how it is done, today?'" No. The Linux source distribution has a /arch subdirectory with at least twenty-five entries in it. Nearly all of them are "assembly-language architectures." All of them must somehow be equally supported.
I have an opportunity to take an assembly programming class and wanted to read opinions about its future use among all these "powerful" high levels languages. (I'm clear that assembly is not one language)
I'm new to programming. Been playing with C and Python for 2 months.
Does anyone do work in assembly exclusively, possibly mixed in with C?
Would anyone recommend learning assembly??
Yes, definitely learn assembly - the joy of being on the raw hardware is unparalleled.
I've never used that book, but assembly for the 80386 is a very good start because it's nice and simple - and most of the 32-bit instructions are still used in the latest x86 class of CPUs. Also, the 80386 I think is the first CPU in its family with a virtual memory manager.
When you've had enough fun playing with that, you can pick up the appropriate datasheets for newer classes of x86 CPU and see the new features (too many to remember) and the multimedia instructions. Maybe stick to the latest multimedia instruction sets (SSE2, 3DNow!, - hmm, what's 'MMX' called these days?) Nothing wrong with learning the older 'multimedia extensions' except that it's not of much value unless you're working with a pretty old CPU.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.