Have you ever watched a Roomba work its way around a room? They work in a random and chaotic manner - first they go a bit this way, then a bit that way. They bounce off of walls, chew up cords, and generally make a nuisance of themselves. Sometimes, they sit for a few
We all know (or at least we should know) that we can use #define to create macros that replace names with values during the preprocessor phase of compilation. Sometimes, it's very important for us to have the ability to change large amounts of code very quickly, because we have a new size limit for
Ever noticed that Java has no header files? Instead, Java uses one file to store each public class and its functions.
Why would they require each class to have its own file? It's a question of simplicity for the Java designers. The Java precompiler (as it were) builds class symbols using the file names, which
In the world of C/C++, we use headers extensively. The basic rule is that C/CPP files contain code that becomes binaries, and H files contain the interfaces that allow us to reference them in other C files. Any program more complex than a calculator will likely contain multiple C files that are combined into
If you are making a product that will employ unique self-signed certificates and private keys, how would you go about it? The two basic techniques are:
Run a tool like OpenSSL's cert tool, either at user discretion or through a script
Build the certificate generator directly into your program
Let's take a quick look at what each
malloc(): memory corruption
When you look at an error message like that, what could possibly lead you to believe that, a hundred lines up, you didn't properly initialize a size variable? After all, all we know is that this malloc() operation could not complete because the memory it should be able to touch is corrupted.
On Friday, I spent a number of hours trying to run down an error in a fairly substantial piece of code. All I really knew was that I kept getting an error that said something like:
*** glibc detected *** ./my_program: malloc(): memory corruption: 0x0000000002296980 ***
When I pushed this piece of code through gdb, I
If you've spent any appreciable time in the programming world, you've probably reorganized your code any number of times. When I'm writing code, I usually slap things out as I think of them, resulting in code that (while easy enough to read) defies the principle of unity. You'll see me write things like this:
One of the key worries I have heard from those ill-informed OOP programmers is that C cannot protect inputs you pass into functions. They use private fields and retrieval functions to ensure that the stored value is protected from unwanted modification.
However, this concern is addressed by C's const keyword.
Taking a const value
There are times
In languages like Java, we have a standardized error-handling paradigm in the try-catch expression. Effectively, this hands all error-handling off to the computer, which monitors all code in the try loop for any and every kind of possible error. While we are able to restrict the range of errors in many cases, the fact