






Declare types rather than using raw C types so that if your implementation changes, you don't have to do a lot of editing by hand. It's much better to declare a type (via class
definition or typedef
) that represents the abstract concept, and to phrase your declarations that way. This lets you change your implementation by editing the original type definition.
long time;
short mouseX;
char *menuName;
typedef long TimeStamp;
typedef short Coordinate;
class TString { ... };
...
TimeStamp time;
Coordinate mouseX
TString menuName;
NOTE
A typedef
doesn't introduce a new, distinct type; it's just a synonym. Also, the compiler doesn't warn you if you mix it with any other type that is defined synonymously.
For more information about raw C types, see "Bad assumptions" on page 140.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker