Recently, The article <The Dark Side Of C ++> has been widely reproduced. As a programmer who eats C ++, you should download it and read it carefully. In general, the summary is quite comprehensive. Due to the limitation of personal knowledge, I divided my personal knowledge into three categories: I did not agree with them, and I felt that they were not on the dark side, however, it is hard to understand, and the other type of research needs to be studied at a later time.
I. disagree
2. Share the same feelings
Iii. Future Research
- Has C ++ made any major changes to the namespace?
This estimate is about the design and evolution of the C ++ language.
- Writing a good library in C ++ is basically impossible.
I have seen many people, including cool people, say this, but I wonder if I have provided a list. The shortcomings in C ++ make it impossible to write a good library. Which languages are acceptable? Why?
- We should not throw an exception in the constructor, because: Exceptions in constructor don't unwind the constructor itself.
I don't quite understand this. As far as I know, throwing an exception in the constructor is a method in which the constructor reports an error because the constructor itself does not return any value.
- When an exception is thrown: Does not even clean up local variables!
I don't understand. Isn't RAII memory management by using the local object structure.
- Assert (s [s. size ()] = 0); works if s is a const std: string, butis unde incluned if it is not const
I tried it on VC2008. No problem. Why?
- If you call delete when you shoshould have called delete [], the pointer wilbe off by sizeof (int), leading to heap resume uption and possibly code execution.
Don't understand.
- If you call delete [] when you shoshould have called delete, some randomdestructors will be called on garbage data, probably leading to code execution.
Why, delete [] will calculate several elements in the array, and the answer should be 1, so there should be no question-this may be related to the previous answer.