Overriding a virtual member function in C++ can go wrong in many ways, most of which the compiler won't detect. Learn how three new C++0x attributes can help you avoid the bugs associated with overriding virtual functions.
For
C/C++ | October 15, 2009
The "most vexing parse" is a mysterious syntactic specter that the compiler interprets in the least expected manner, biting innocent programmers who think their code means something entirely different. Find out where that vexing parse might occur and how to avoid it.
For
C/C++ | September 17, 2009
A base class with multiple constructors forces a derived class to define corresponding constructors that merely forward their arguments to the matching base constructor. In C++03, you define the derived class's constructors manually. Learn how C++0x's inheriting constructors feature automates this process, thereby simplifying code maintenance and making your code more readable and secure.
A new C++0x feature called forward enum declarations allows you to declare an enumeration without providing its enumerators list. Learn how using it can avert long compilation times and ODR violations.
Danny Kalev asks Bjarne the hard questions about concepts and C++'s future.
For
C/C++ | July 16, 2009
A new C++0x feature called a class member initializer allows you to specify a single initializer in the very declaration of a data member. Learn how to use this feature to simplify your constructors' code, reduce potential bugs, and make your code more readable.
Migrate your fixed-sized sequences to std::array, which offers a secure, efficient, and convenient alternative to built-in arrayssans the overhead of vector.
A
good parasite class promotes the use of objects that are never destroyed, a controversial notion in C++. So why use it? What other advantages does it offer? Can you declare additional member functions in such a class? The inventor of the good parasite technique explains.
Learn how to use attributes, a new C++09 feature, to specify additional information about your programming constructs conveniently and portably.
Your C++ application doesn't have to allocate a new chunk of memory on every loop iteration. Learn how to implement a single raw memory buffer that knows how to clear itself securely.
You can initialize C++09 Standard Library containers with a list of initializers, but what about your homemade container classes? Sequence constructors enable you to initialize instances of your homemade classes in a similar fashion.
For
C/C++ | February 12, 2009
An abstract base class from which concrete classes are derived is a very common idiom in object-oriented code. So common indeed that a special design pattern called Factory was devised to simplify the runtime creation of derived objects. Learn how Factory can boost your code's reliability and performance.
For
C/C++ | January 16, 2009
Experts predict that 2009 will be the year of the functional programming paradigm. The revised and enhanced C++0x lambda expressions syntax provides you with exactly the right tools for painless functional programming. Learn how lambda expressions can boost your code and eliminate tedious manual coding.
For
C/C++ | December 11, 2008
Prior to C++0x, multithreaded C++ applications relied on platform-specific features that were neither portable nor easy to grasp. C++0x fixes this omission with a new multithreading library. Learn how to use this new library to write portable and clean multithreaded C++ code.
For
C/C++ | November 13, 2008
Not only does C++98 have four different syntactic forms for initializing class objects, aggregates, char arrays and scalar types, it doesn't let you initialize member arrays and dynamically allocated arrays at all. Learn how C++0x fixes these flaws with a uniform and intuitive initialization syntax.