Data Type ConventionsThe actual representation of a data type declaration may vary from one operating environment or processor type to another. For instance, on one system the int data type may be represented by a 2-byte integer, while on another system int may be represented by a 4-byte integer. Our goal is to make a product using c-tree Plus as portable as possible. Differences like these between systems can interfere with that goal. We want to ensure that a 2-byte integer in c-tree Plus will be a 2-byte integer on any system. Therefore, we define our own data types as shown below. By carefully using these data types, you guarantee that a program operates consistently across all supported operating environments. The following data types are used throughout the c-tree Plus routines called by your application programs. C language typedefs have been included in the c-tree Plus header files. Most of these will be found in the header file ctport.h. We recommend that you use these conventions in your products, as well. By carefully avoiding the use of native variable types in your variable declarations you can create an application that is very easy to port from one compiler, or operating environment, to another COUNT UCOUNT LONG ULONG TEXT IFIL DATOBJ VRLEN UINT VOID #define void void If your compiler does not support the void declaration, substitute the following; #define void int VOID pointers are better than character or TEXT pointers when you are passing a variable address to a function, and you don’t know if you are going to use a character string or a structure. A VOID pointer is a generic pointer, and if you are using function prototyping, it will let you use any type of variable pointer. A TEXT pointer will give you a warning when you compile a program passing a structure address. p TYPES |
|||