I recently read Objective C ++ 2/E, which is often laughed at by humorous words. This is one of the most interesting technical books I have ever read. Of course, this is also inseparable from the excellent translation by Master Hou Jie. So easily, I have read half of the book. Of course, the content in the book is the basic C ++ content.ProgramKnowledge required by members.
Here are some humorous articles from the author:
1. (p76) As you have seen, the problem of Alias (aliasing) will appear in a variety of shapes, so you can not look like an ostrich, blindfolded think that it is okay to not see. Maybe you can, but most of us cannot.
2. (p123) the following is an object-oriented romantic conversation:
Object A: Dear, don't worry!
Object B: Don't worry, kiss me. I am a constant (const ).
However, just like in real life, A's heart secretly speculated: "Can B trust ?" Just like in real life, the answer depends on B's nature. I mean it depends on the composition of its member functions.
3. (p127) for example, let's look at the following function, which returns a String object:
String somefamousauthor ()
{
Switch (RAND () % 3)
{
Case 0:
Return "Margaret Mitchell"; // start with "Gone with the Wind", a real classic
Case 1:
Return "Stephen King"; // his novels make millions of people sleepless
Case 2:
Return "Scott Meyers"; // the story of this person is different from that of other authors.
}
Return ""; // we can never get here, but in a function that "must return a value", all paths must return a value. Alas!
}
4. As we all know, a programmer is a race with sloppy personality. I am not saying that you must be very hasty or I am very hasty, but if the programmer is not a bit (Can I really say it ?) It is rare to have a strange tendency.
5. (P134) if this was the case, it would have been your best luck to be attacked by everyone. More practically, you will be peeled off or fined for 10 years, responsible for writing microcode for the electric iron and toaster ).
Now let's take a look: if you write a function and return the so-called dereferenced pointer, it's simply a memory leak.
6. (pinging) even if you have virtual memory, the Program Code caused by inline behavior will result in pathological paging) behavior (also known as thrashing) will slow your program as a snail crawler (but it can provide a good motion opportunity for the hard disk controller ).