I’m running through the Learning to program with Haiku book by DarkWyrm for google code-in.
In past, I have always programmed in higher level languages like Python and Java, so I’m a novice in any C based languages.
Is it, in practice, really necessary to completely understand binary to be able to program in C or C++?
I have a basic understanding but I was wondering how in-depth I need to go to be able to program in Haiku.
If you mean assembly, no. You wont need it unless you have to go to a low level coding, or need very optimized code.
If you mean binary logic (as in true/false), you would be OK with previous knowledge.
If you mean bit arithmetic (bitshifting, xoring, oring, adding, …) then you might need to understand it for some C/Cpp code.
If you mean binary files, you might need to understand what compilation means, and that it involves the steps of compilation + linkage to generate a executable file for the target OS. Just pointing as this, as you have only experience in non-compiled languages (stated above).
Well you don’t need to be a binary calculator. But you have to understand how logical operators works. You need to understand two-s complement and the problem of the double representation of zero, and so, how negative numbers are represented. Especially if you plan to do low level programming. In general, if you’re young I’d suggest to learn this stuff. Your brain will be thankful in a few years.
There’s really not much to understand in binary. Beyond working with bitmasks and the occasional bit of bit manipulation to avoid some clunky operations in C, there’s really no need to have a grasp of binary or hexadecimal besides how to read a number. Most calculator programs convert between bases. It’s what I use. i trust them more than myself.
When programming, you can work in as high or low level as you want. Although there is always a correct tool for the job. Choose the wrong tool and it’s like trying to fix a watch with a sledgehammer, or move a mountain with tweezers.
I like working with hardware. Low level / bare metal. What I said above is about all I need to know in terms of binary. I can’t read an opcode from a string of 1’s and 0’s or even from hex digits. Decades of hard work by countless people has made modern computers this way. Things can be as simple or as complex as you want. Just go for it and learn as you go.