C++0x Support in TnFOX

Note:
v0.88 could not get move constructors working properly in GCC v4.3 and so this particular feature has been disabled for now.
For a very long time now, TnFOX has contained support for one particular C++0x feature (move constructors) but the code had always been ifdef-ed out. As of v0.88 of TnFOX, GCC v4.3 finally has some very limited support for C++0x features and thus finally we can enable support. This is done by setting the enableCPP0xFeatures variable in config.py to True.

Changing this is a profound setting - it enables many new coding paradigms. Almost all existing code is forward compatible, but some is not. In particular, code which uses one of the new keywords as a variable name will cease to compile and additionally some constructs will need reworking to function correctly.

However, the benefits are many and huge. TnFOX has implemented move semantics for quite a few classes where it made sense since its inception, but it has always been a nasty hack which technically broke the ISO C++ coding standards - the fact it worked at all was more luck than design though of course it was and is a very common hack. MSVC had particular support through allowing non-const constructors which had to be implemented in GCC by deconsting the copy constructor parameter (always praying that the optimiser wouldn't remove the move construst). Enabling the C++0x semantics finally fixes this, and furthermore lets the optimiser know what's going on which should help greatly - in particular, we finally have proper syntax support for move-only objects and the compiler will correctly barf if you try something stupid. The move semantics in TnFOX always operated on a pointer, so speed increases in TnFOX only code will be nil - however, all the STL containers now have move support which makes all the Qt thunk emulations considerably quicker when working with value items. You need of course to add your own rvalue copy constructors in order to avail of move semantics - the STL and Qt thunk classes will default to normal lvalue copy constructors.

As of v0.88 of TnFOX, the following C++0x features have been implemented. This list is limited by what the latest GCC has implemented:

  1. Move constructors using rvalue references (N2118) have been implemented in most of the class objects which might end up in a container have move constructors where possible. All Qt thunk classes and anything which can act as a container will use move construction where possible.
  2. FXSTATIC_ASSERT() will use the new static_assert() function (N1720). This greatly improves error message reporting.
  3. FX::FXException will use the new __func__ meta-variable (N2340) in error reporting.
I would just love to add template typedefs and variadic template arguments, and they will come eventually outside rvalue support. For now, enjoy the performance increases and let me know if I have broken anything!
(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:36 2009 for TnFOX by doxygen v1.4.7