#1 Members - Reputation: 105
Posted 17 April 2012 - 05:17 AM
(consider that when i saw square(3++); i thought 4 would be sent as a parameter i tend to agree with him)
so does anyone know where i could learn about how assembler works? i dont want to learn to code in it just understand the principles of how it does things.
#2 Moderators - Reputation: 13533
Posted 17 April 2012 - 05:43 AM
Back to your actual problem though, in a Computer Science or Software Engineering course, you'd likely take a class called something like "Computer Architecture", where you'll learn the basics of different hardware components, assembly languages, and low-level OS systems. Reading some text-books on "computer architecture" and/or "operating systems" may be useful to you.
#3 Crossbones+ - Reputation: 1158
Posted 17 April 2012 - 06:36 AM
PS:
Its a good habit to write your for in the following manner:
for (int counter; <condition>; ++counter)
{
}
In this case it isn't really an optimisation just a habit so that when the ++operator is overloaded and does more work than you expect your not making an unessecary assignment. This is mostly the case when you have a custom assignment operater that makes a non-shallow copy.
#4 Members - Reputation: 437
Posted 17 April 2012 - 08:24 AM
It could be considered nitpicking (since it was not what you aimed at), but I have to say that I would not consider this for-declaration "good habit" as it is using the uninitialized variable counter... Just saying ;)PS:
Its a good habit to write your for in the following manner:for (int counter; <condition>; ++counter) { }
#5 Members - Reputation: 107
Posted 17 April 2012 - 09:24 AM
so does anyone know where i could learn about how assembler works? i dont want to learn to code in it just understand the principles of how it does things.
If you want to get a good understanding of assembly, and computer architecture, (how hardware plays nice with each other) I suggest that you download some of the microcontroller documents - I develop on the Microchip (http://www.microchip.com/) PIC lines, and they have a very simple to understand language as they are not CPUs, but MCUs and therefore don't have all the shift registers, and alike that can cause the novice to dropout from learning the language due to confusion. Read about how to connect peripheral devices (as that is everything not embedded in the CPU/MCU - including memory are really peripheral devices.) - I know that the Microchip's documentation on each chip is very well written and comprehensive - and best of all free. There are other MCU manufactures out there - I just like the PICs.
Edited by MESEnterprisesLLC, 17 April 2012 - 09:28 AM.
#6 Crossbones+ - Reputation: 1158
Posted 17 April 2012 - 09:32 AM
It could be considered nitpicking (since it was not what you aimed at), but I have to say that I would not consider this for-declaration "good habit" as it is using the uninitialized variable counter... Just saying ;)
Yeah my bad I should have initialised counter, it was more the incrementer pattern I was on about :$.
#7 Members - Reputation: 100
Posted 17 April 2012 - 06:43 PM
By the way, I know you asked about assembly, but from what I could gather about your intentions, I'd say you'll do better with one of these courses. Paradigms touches on assembly a bit, but you're probably more concerned with getting a feeling for the mechanics of C++.
Edited by alcedine, 17 April 2012 - 06:49 PM.






