New updates of C++Hints, service of recommendations on C++ programming
Changes in CppHints.com
by PVS-Studio Team
We got a lot of positive feedback from our readers and continue developing the C++Hints project. We have also answered two requests, that we saw quite often in the letters:
- The RSS feed is added (http://cpphints.com/rss)
- The up-to-date full list of hints is created at: http://cpphints.com/archive
By this moment we have published the following articles:
- Why incorrect code works
- Don't forget that the loop termination conditions are always evaluated completely
- Undefined behavior is closer than you think
- Visual C++ and wprintf() function
- Use a prefix increment operator (++i) in iterators instead of a postfix (i++) operator
- Avoid using a macro if you can use a simple function
- Don't name functions "empty"
- Hot on the heels
- Make your code more stable
- Insidious VARIANT_BOOL
- Do not compare 'this' to nullptr anymore
- Use the keyword "override" when overriding virtual functions
- Evaluate the string literal length automatically
- Do not use #pragma warning(default:X)
- Table-style formatting (continuation)
- Make sure you work with data in streams the right way
- Delegating constructors make life easier
- Use dedicated functions to clear private data
- Table-style formatting
- Don't spare code lines
- Start using enum class in your code, if possible
- A good compiler and coding style aren't always enough
- When using Copy-Paste, be especially careful with the last lines
- Don't try to squeeze as many operations as possible in one line
- Use the '\0' literal for the terminal null character
- Avoid using multiple small #ifdef blocks
- Beware of throwing exceptions in destructors
- Check all the fragments where a pointer is explicitly cast to integer types
- Do not call the alloca() function inside loops
- Don't Do the Compiler's Job
- Use available tools to analyze your code
- Larger than 0 does not mean 1
- Copy once, check thrice
- Beware of the ?: operator and enclose it in parentheses
Add a Comment
Comments are closed.