|
|
HP C++ Programmer's Guide: HP 9000 Series Workstations and Servers > Chapter 5 Inter-Language CommunicationData Compatibility between C and C++ |
|
Since C++ is a superset of C, many of the data types are identical. Both languages have the identical primitive types char, short, int, long, float, and double. ANSI C and C++ also support a long double type (and include a language extension for a long long type for versions 10.22 and later.) Pointers, structs, and unions that can be declared in C are also compatible. Arrays composed of any of the above types are compatible. C++ classes are generally incompatible with C structs. The following features of the C++ class facility may cause the compiler to generate extra code, extra fields, or data tables:
It is the use of these features, as opposed to whether the class keyword is used rather than struct, that introduces incompatibilities with C structs. |
|