Originally Posted By: kornstar
Just out of curiosity... what is 0xC3?..

It honestly doesn't matter, it's just Chaos trying to sound smart and then ending up mixing multiple buzzwords that have no relation to each other.

If you want to know the full story in short, your code gets compiled down to machine code at some point (usually with various intermediate steps from high level C to machine code). The CPU will then execute the machine code, as that is the one it understands, note though that there is not necessarily a direct conversion between high level C concepts and what the CPU will eventually see. In any case though, the machine code is, well, machine dependent, and the code the CPU can execute is called the ISA, short for instruction set architecture. Your normal desktop CPU that runs Windows runs the x86 or x86-64 ISA, which is an ISA that has grown since the Intel 80386 (released 1986). One of the many instructions the ISA offers is the return instruction which returns back to the caller, and encoded in hex it's 0xc3. It matters fuck all in your every day coding, so you might as well forget everything about it.

Now, for void vs everything else. void is just saying that the function won't return any value, whereas for example int means the function will return an int to the caller.

This is tied to return only insofar that you use return to return a value to the caller and a function that returns anything but void has to have a return with a value somewhere to not be malformed. Of course this would break a lot of badly written Lite-C functions so the compiler doesn't enforce it. You can use return in void functions too though, it just won't return anything. But it can be used to pre-maturely leave a function based on a condition or whatever.

When your function reaches the last closing bracket, there is an implicit return from it.

There is no advantage of one over the other. Some dipshits used to spread the rumour that one is faster than the other, but luckily this hasn't come up in the more recent past. If you find a reference to this anywhere though, just remember that it's absolute bullshit and don't believe anything the author has to say. The real difference is that you provide intent. If you intent to return an int, then declare your function as returning an int. If you don't return anything, use void. That way the compiler can help you out (if it weren't for the fact that it's shit) and you can get an idea of what the function will do based on just looking at the functions signature.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com