Prelude to Computer Science - 12: The Concept of a Variable
Uploader Comments (TheFallibleFiend)
All Comments (9)
-
Brilliant !! So easy to understand when you explain and I think it will help me a lot to become a better programmer.
-
Thanks! I aiming on assembly just to learn how computer really works. It in my nature...I just cant accept that something is working without knowing how it really works. Its not very profitable to learn this way since I should rather spend my time learning some software solutions. I started with Unix and have realized that the best way to really understand computers and OS is to do programming on both levels-High and low level programming.
-
Thanks for the response. I'm glad it was helpful. C is a very good language to learn. Whether assembler is useful monetarily depends on what kind of job you have; however, regardless of whether you ever write any assembler on the job, it's generally useful for solidifying your knowledge of how the computer works. Good luck!
-
Sorry 4 late response. I didnt have access to internet for a while(Trip).
Anyway...yeah, your videos have helped me alot!!! Im in process of learning C and I'll think Ill move after to assembly or will do that in parallel with C.Long way to go but I have time...and you helped me on that path.
-
In "float a = 12.4" it's the compiler that is first aware of the types and translates to the appropriate load command. In the cases I'm familiar with, there are separate LOAD, STORE, ADD, MULITIPLY, etc. commands for integers and for floats (and different still for doubles!) and it's the compiler that translates to the correct op code. Does that answer the question?
what about signed and unsigned numbers? They look the same in memory, how does the computer know how to handle them? Do they have separate instructions for them too?
adikid89 1 year ago
@adikid89 Very good question. It's the same opcode for both signed and unsigned, because both are handled with two's complement arithmetic. The difference is in how the return flags are handled. (It's been decades since I messed with it, so I apologize for not recalling the precise details.)
TheFallibleFiend 1 year ago
@TheFallibleFiend Any idea on where to find further information about this? What return flags are you talking about here? The sign flag and overflow flag? I know that overflow happens in two's complement... does that have anything to do with how the computer knows that at that address there is a negative number?
adikid89 1 year ago
@adikid89 Yes, those are the flags. Probably wiki has something on it under "two's complement arithmetic." IIRC, the computer doesn't know a number at a location is negative at the level of assembler / machine code.
TheFallibleFiend 1 year ago