In C, it is common practice to return ints for better error handling. Example, one could return -1 if the task was unsuccessful.
Printable View
Yes it's used for that, but in this case Jaden didn't added any check that can return -1. Also by default if an execution time happens this method will return void, or better in some cases, will return false (0).
Also the parte of sizeof(bool) - 1, it's kinda lmfao. I didn't get what he tried with that. But whatever.
A boolean is *at least* but not limited to 1 byte, which is why I was getting the size of a bool on the machine and subtracting it by the byte that was read.
method returning a void? Elaborate? My current implementation passes a pointer to object which will be changed, I haven't added errors in yet but 0 is success and -1 means buffer overflow.
Seems like you're nitpicking tbh, but if you truly don't understand my tactics then you can watch more here (Stanford University C lecture)
https://www.youtube.com/watch?v=jTSvthW34GU
EDIT:
Another good read.
In C how much space does a bool (boolean) take up? Is it 1 bit, 1 byte or something else? - Stack Overflow
Any updates on this? ;)
"since you have no checks it's retarded code"
I'm trying to be as nice as I possibly can with you, so right now we're heading towards passive aggressive.
What "checks" are you referring to? You need to acknowledge that you are viewing unfinished code, every function is designed said way for a reason and you a few times in C... you might have no reason at all other than the fact that you know there will be errors to check for in the future.
The current checks that were not committed were checking for buffer overflows, but if you were using the functions correctly and knew the habbo packet structure then you wouldn't have any problems anyway.
It's not about whether it "looks" like it make sense. See that's the difference between writing code, and programming software. In my opinion at least.
Coding vs. Programming -- Battle of the Terms! | Huffington Post
No funny shit but...
Doesn't take a genius to figure out where I was going there, just a REAL programmer. and @Leon (and anyone who thought the same before reading his post) happen to be the only ones thus far.
Btw, been added these checks -- yet to commit because my computer time has been cut short lately. Got a big test tomorrow.
http://image.prntscr.com/image/6f6ce...603430f639.png
- - - Updated - - -
My monitor broke a few days ago and my PC doesn't take VGA (only HDMI) so a replacement is going to be expensive :(
Been using the flat in the family room and I can't be in there monopolizing all day, so every once and a while at night. I'll commit a few bug fixes I made to the source code a while ago to Git because I was holding back until everything was working.
You may want to re-think about your buffer_bytes_available. For example what happens if I do (buffer, 10000) while the size is only 10?