For the past month I'd been working on a project using C++, a programming language I've been overly hating and avoiding until recent. After struggling with its rich but misleading features, I finally realized that it was all about smart choices: It's like there are healthy food and unhealthy food and it's up to you to choose what to eat. In order to make smart choices, the first thing you need is to know about their nutrition facts. Below are some notes I would like to keep in mind:
1. STL is too general to be efficient.
For maximum efficiency, write your own basic data structures.
2. Exception handling doesn't come for free.
For maximum efficiency, use old-fashioned error messaging instead.
2. Virtual destructor is needed when you delete a polymorphic object pointer.
See this article.
3. Be careful about 'const' declaration.
See this article.
4. Read this FAQ carefully for thoughts about the design of C++.
Learn how, learn why.
5. For sockets programming in C++, start from this article.
Examples are a good start point for a lot more improvement.
1. STL is too general to be efficient.
For maximum efficiency, write your own basic data structures.
2. Exception handling doesn't come for free.
For maximum efficiency, use old-fashioned error messaging instead.
2. Virtual destructor is needed when you delete a polymorphic object pointer.
See this article.
3. Be careful about 'const' declaration.
See this article.
4. Read this FAQ carefully for thoughts about the design of C++.
Learn how, learn why.
5. For sockets programming in C++, start from this article.
Examples are a good start point for a lot more improvement.
Comments