a compiler is just a program that converts your code into binary, am i right?
so in theory if you were able to fluently write stuff in binary, you wouldnt need a compiler right? like you could just have written commands straight to the pc, am i right?
btw i wont go and do this (might try for the heck of it) but i just am curious sometimes :P
so in theory if you were able to fluently write stuff in binary, you wouldnt need a compiler right? like you could just have written commands straight to the pc, am i right?
What you are talking about it more or less, Assembly Language.
The compiler actually translates the high level language to assembly, then an assembler takes the assembly code and converts that to machine code.
128 posts, lol. Well, everything in a pc is stored in his own binary format, so in theory, you are able to write every file 'by hand'. It's just too much complex.
"128 postst,lol." -not quite sure why you would say that, was my question really that dumb?
and i'l admit i havent really done much research on what the compiler does to your code, i just assumed it was translated into binary since binary is known as "the language of the computer" or whatever :P
and also i did state in my opening post that i am curious, and whenever i get a queston popping into my head i just need to find an answer, or else i would probably go insane :O
128 is a "round number" in binary (like 100 in decimal), represented by "10000000". Also, it's the number in your name, but reversed. Both are funny enough. To some.
The word "binary" is one of those codewords people use in computer programming, much like "windows" or "hack".
Everything in the computer is technically "binary", since it is all ultimately stored as a sequence of ones and zeros.
However, when we refer to "binary" we typically mean that the data is encoded differently than it would be "textually". A number, for example, cannot be directly read by a human -- it must first be transformed into a usable textual representation, like 72 or 0x48 (or 1001000 "binary" -- in this case meaning only that the textual radix is 2).
When you store or transmit things in memory (for example, saving data to a file on disk, or write to a socket over the internet), textual representations tend to be larger than the computer's representation, so we typically prefer to do it in a computer's representation, calling it "binary".
There is no one true binary, however. The way things are organized still have to be decided. For example, a number that is bigger than a single byte (like 4321) can be stored more than one way. (Google around "endianness" for more.)
The computer itself does not work over human-readable information. Certain numbers have specific meanings attached to them. For example, and I am totally making these numbers up, the number '12' might mean 'shift register A right by the number of bits indicated in register B. So, when your computer is executing your program (a list of numbers that the computer understands in this way), when it comes upon the number twelve it shifts the value in register A left by the number in register B. We could say 2 means store the next number in register A, and 3 means store the next number in register B.
In C++, we would write "int x = 10 >> 1". When compiled, it might look something like
2 10
3 1
12
Et cetera.
This is a very simplistic model, but it gives you the right idea.
As to your question, back in the really early days on mainframes and the like, you did just write straight machine code. No assembler. No C or C++. Just numbers. As you can imagine, the debug sessions for that kind of stuff were nightmarish.
Since dealing with every bit of minutiae like that limits your ability to write fancy software, it is usually only reserved for certain special occasions.