Node: Type Checking, Previous: Accessing Subtypes, Up: Subtypes



Type Checking

When dynamically typed objects are being processed in Lpp in a type safe mode, objects are dynamically checked for the expected type. In Lpp this is enfored with the the macro, See Accessing Subtypes. This usually only occurs at one place in object accessors. When it is not of the expected type control is transferred to a specified handler, usually to an error code handler.

The default is to have this dynamic type checking turned on. It can be turned off per compilation unit with the following define that must precede the include of Lpp.hh

             #define LPP_NO_TYPE_CHECK 1
     

This automatically modifies the behavior of the the macro. With type checking turned off the users code using Lpp is just as efficient as ordinary C++ code accessing statically compiler type checked references. Rarely do you want to turn off type checking while developing a program and usually doesn't even hurt the efficienty too much on a delivered package.

The above methods turns off type checking per your compilation units that see LPP_NO_TYPE_CHECK as defined above. If you also want the Lpp library itself to not do type checking then you need to recompile the Lpp library in the same way as above or better yet link your program with the Lpp library where this has already been done as for example linking with the Lpp supplied library

     libLppNC.a
     

instead of libLpp.a. You can optionally make and install libLppNC.a in the Lpp installation, See Installing Lpp.