[Xorp-hackers] FYI: C++0x language standard is now ratified
Bruce M Simpson
bms at incunabulum.net
Tue Nov 4 05:18:54 PST 2008
Hi,
This is just to propagate the announcement that the next version of the
C++ language standard, C++0x, has now been ratified.
Links:
General announcements:
http://herbsutter.wordpress.com/2008/10/28/september-2008-iso-c-standards-meeting-the-draft-has-landed-and-a-new-convener/
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2784.html
The working draft itself:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf
GNU C++0x status here:
http://gcc.gnu.org/projects/cxx0x.html
The Wikipedia article is a useful summary which fluctuates:
http://en.wikipedia.org/wiki/C%2B%2B0x
What this means for XORP:
There are a number of places in the XORP code base which could benefit
from using some of the idioms introduced within the new C++0x
specification. Some of these are derived from the Boost++ project.
* std::shared_ptr is a possible fit for the OLSR and OSPF message
handling code.
Note that it's really easy to introduce memory leaks using ref_ptr;
every time one is passed to a new scope, the refcount is bumped, even if
it's "Just passing through".
Boost++'s weak_ptr exists to allow refcounted pointers to be passed
between subsystems WITHOUT losing their refcounted nature, and WITHOUT
bumping the refcount until the ref is actually ACQUIRED.
* Concept checks are being formalized as part of the language, these
are very useful for metaprogramming, i.e. building your own extensions
to the STL containers.
* Variadic macros are now part of the standard. XORP uses these in a
number of places.
Microsoft's native toolchains for example, did not support them until
Visual Studio 2005 was released, and even then as a non-standard
extension to the C99 preprocessor.
* Tuple is syntactic sugar, but welcome nonetheless, we use struct
types in a number of places and tuples would no doubt make things more
readable.
thanks
BMS
More information about the Xorp-hackers
mailing list