The following sections define obsolete and ignored functions and explains how to use these functions in the Open Class Library. To develop portable applications, you should be aware of these areas.
As the Open Class Library functionality increases, there are situations where we must change the interface to improve the quality and design. We identify the interface that is obsoleted and provide this information so you can migrate to replacement classes and functions.
In ibase.hpp we define a set of macros: one to conditionally define the obsolete level for this version of the library, and one for each version of the library in which we have obsoleted. For example, the first version we obsoleted interface in was 310, and the second was 320.
#define IC_OBSOLETE_1 310 #define IC_OBSOLETE_2 400 #define IC_OBSOLETE_3 410 #ifndef IC_OBSOLETE #ifdef IC_WIN #define IC_OBSOLETE 400 #endif #ifdef IC_PM #define IC_OBSOLETE 400 #endif #endif
Obsolete interface is then wrappered as follows:
#if (IC_OBSOLETE <= IC_OBSOLETE_1) // obsolete interface here #endif // IC_OBSOLETE
Notice that IC_OBSOLETE is conditionally defined in ibase.hpp so that you change the define. You can easily identify the obsolete interfaces you are currently using by defining IC_OBSOLETE to be greater than any of the obsolete levels. For example, you define IC_OBSOLETE to be 500 based on the preceding values, you receive compile errors for each obsolete function used in your code.
There are several important guidelines regarding obsolete functions:
When a function cannot be implemented on a particular platform but its usage can be safely ignored, we do so to achieve a higher degree of portability. This is only done when subsequent function calls to the object are not affected by the fact that the function call was ignored.
In order to identify these functions we wrap them in #ifdefs.
The valid values for the no-op macros are the six IC_xxxxxx
macros defined with the string "_FLAGNOP" appended to
them. They are used only with the #ifndef ....
#endif preprocessor directive.
For example, IFont::setFontShear() is a no-op under Motif. Here's what is coded in IFont.hpp:
#ifndef IC_MOTIF_FLAGNOP IFont &setFontShear( ); #endif
These no-op macros are left in the headers so you can identify
which
functions are ignored. If you need to identify which ignored
functions you are using in your code, define the no-op flag for
the current platform and compile the code. For example, to find
the ignored functions on the Windows platform, compile your code
as follows:
icc -Gmt -dIC_WIN_FLAGNOP sampcode.cpp
You receive error messages from the compiler for each ignored function used.
| Note: | Code compiled with one of these macros defined cannot be run because the generated code does not match the shipped DLLs. These macros are only provided to assist you in identifying obsolete functions and code must be recompiled without any of thes macros defined to be executable. |