• Forum
  • Lounge
  • what are the benefits of learning assemb

 
what are the benefits of learning assembly with C++?

Hi I'm a newbie learning C++ and people told me that if i learned Assembly alongside C++ that I'd be a better programmer overall. So I'd like to know what are the benefits of learning Assembly by itself and with C++. What are things that I can do with knowledge of C++ and assembly? that i can't do with C++ alone. How would knowing both make me a better programmer?
You will be looking at assembly when using a debugger. Understanding, for example, why a particular loop was or wasn't vectorized and what changes to the source code would make it vectorizable on a given CPU can make you a hero.

Of course, as a newbie, you are a long way from there, but don't hesitate to actually look at the compiled code.
You really don't have to learn assembly.

Knowing exactly what is going on underneath does widen your understanding of the way the computer works, just as learning how to work a problem from different perspectives (say, functional vs procedural), but in terms of programming in C++, it really doesn't matter. Learn to program good C++ and you'll get good machine code.


BTW, this is a common quackery that has existed forever. "Oh, you're learning <language X>? If you also learn <language Y> you'll be a better <language X> programmer."

Nonsense.


Hope this helps.
+1 Duoas

Learn to write good C++. Don't overwhelm yourself by learning two things at once.
I would listen to LB and Duoas. However, if at some point you want to learn (a flavor of) Assembly, a great way to learn would be to write an assembler in c++. I'm writing a virtual machine in C++ which is an interesting way to learn about stack based processing
There are specific applications of C++ that require knowing Assembly. For example, something like boost::context is impossible to do in pure C++. If you're doing any kind of API hooking, knowing some Assembly helps a lot.
BTW, this is a common quackery that has existed forever. "Oh, you're learning <language X>? If you also learn <language Y> you'll be a better <language X> programmer."


Arguable. Sometimes when learning another language you learn different approach, thus expanding your knowledge. Next time when facing problem you can apply new paradigms and solve it more efficiently. Of course, it's not guaranteed to make you better X programmer, but there's a chance - and learning new things never hurt nobody ;)
I'm with MatthewRock. In science when they try to better understand a certain rule they try to find an exception and determine the differences.
@MatthewRock
You're arguing what I just said, then equating it to the opposite of what we both agreed. Figure it out.

Sometimes when learning another language you learn different approach, thus expanding your knowledge.
True.

Next time when facing problem you can apply new paradigms and solve it more efficiently.
True, assuming said new paradigm is applicable to <language X>. For the sake of argument, I'll agree that it is.

Of course, it's not guaranteed to make you better X programmer,
Oh, that darn fly in the ointment.

but there's a chance - and learning new things never hurt nobody ;)
http://www.dailymail.co.uk/news/article-3193929/Alabama-mayor-74-beaten-baseball-bat-former-radio-host-71-revenge-sex-tape-man-s-wife.html

Absurd?

How about learning memory management in C? Does that apply to being a better C++ programmer?


So, specifically, assuming you have two Turing complete languages, what about <language Y> makes anyone a better programmer in C++? (And remember, if it can be easily learned without language Y, then the argument doesn't hold water. You've got to find something that <language Y> is uniquely suited for teaching a principle of programming in C++.)
@Duoas
Please, don't start a dogmatic discussion.

Oh, that darn fly in the ointment.
But is his statement wrong?

Absurd?
Honestly.

How about learning memory management in C? Does that apply to being a better C++ programmer?
Maybe it does, may be it does not. What kind of anwer do you expect?

You cannot really claim that it is wrong to learn another language...
But he could well claim (and I agree) that it is wrong to learn more than one language at the same time as languages use not only different syntax, but often require a different program structure / development paradigm to work most effectively. Hence I'd go with learn one language until you are confident making programs, learn another until you are confident making programs etc, then once you've learnt several, you might notice that the first ones have become easier because you understand things from the perspective of more than one type of language.
shadowmouse + 1

[edit] It's okay, though. These kinds of things always degenerate into straw man.
Last edited on
Once you've got your first language just do what I do now and learn every language on the fly :D

Since I've started work (Oct 2014) I've had to learn VB, C#, Javascript, XML (for Wix framework), 2 different visual frameworks for these languages (.NET & Projektor) and the amazon dynamodb and Google bigquery frameworks...

I can pretty much jump into a language and just go (granted there will be a lot of googling).
Need a program? What language would suit it best? Guess I'm learning a new language this week XD

Oh, and I'd studied C++ as hobby for 3 years before starting work... no C++ here :p
Assembly language in itself is useful when you are faced with a bug and you have step through the assembly to figure it out. This is pretty rare in my experience but it can really make you a hero.

What's more important than assembly language itself is knowledge of computer architecture, which you'll learn along the way with assembly (at least a little). Knowing computer architecture can be very helpful in understanding performance issues and some bugs.
Topic archived. No new replies allowed.