next up previous contents index
Next: supported #pragmas Up: Object Reflection Previous: Synopsis of classdesc   Contents   Index

Limitations to classdesc

Classdesc will work with any syntactically correct C++ code, and attempt to do the best it can. It ignores anything that is not a struct/class definition, or an enum definition. Classdesc does not preprocess the code presented to it -- if you depend on the preprocessor in your class definitions, you must filter your code through the preprocessor first,4 defining the macro _CLASSDESC to ensure pragmas are seen by the Classdesc processor.

Unfortunately, overloaded member functions cannot be resolved to a distinct member pointer, so are quietly ignored by classdesc. This is not an issue with serialisation, of course, as all member functions are ignored, but has implications for descriptors such as TCL_obj that export object functionality.

Raw pointers also cause problems in that there is no information at runtime about how many objects a pointer points to, or whether it is reasonable to extend the array with memory taken from the heap. Support for the various uses of pointers is discussed in §13.2.1.

Another issue that occurs in reference to types defined in the current namespace with template parameters occuring as part of a specialisation. For example:

namespace frozz
{
  class Bar {};
  template <> class Foo<Bar> {};
}
In this case, the classdesc processor does not know which namespace Bar is defined in, (as its more forgetful than your average C++ compiler), so you will get a compile error that Bar is unknown. The workaround in this case is to full qualify type where necessary, ie replace the above code with
namespace frozz
{
  class Bar {};
  template <> class Foo<frozz::Bar> {};
}


next up previous contents index
Next: supported #pragmas Up: Object Reflection Previous: Synopsis of classdesc   Contents   Index
Russell Standish 2016-09-02