443
edits
Changes
no edit summary
compilers.
;char :is at least 8 bitsshort is at least 16 bitslong is at least 32 bitsint is the same as either short or longfloat is at least 32 bitsdouble is at least as wide as float
;short
:is at least 16 bits
;long:is at least 32 bits ;int:is the same as either short or long ;float:is at least 32 bits ;double:is at least as wide as float Because of the variable width of an int, it is recom-mended recommended that short or long be used wherever possible in
preference to int. The exception to this is where a quantity
is required to correspond to the natural word size of the
this problem other than to avoid code which depends on a
particular ordering. In particular you should avoid writing
out whole structures to a file (via _�f_�w_�r_�i_�t_�e<strong>fwrite</strong>()) unless the
file is only to be read by the same program then deleted.
Different compilers use different amounts of padding between
structure members, though this can be modified via the#pragma pack(n) construct.
== Predefined Macros ==
One technique through which machine unavoidable machine
dependencies may be managed is the predefined macros pro-vided provided by each compiler to identify the target processor and
operating system (if any). These are defined by the compiler
driver and may be tested with conditional compilation
table 2. These can be used as shown in the example in fig .
;Table 2. Predefined Macros
#if DOS char * filename = "c:file"; #endif /* DOS */ #if CPM char * filename = "0:B:afile"; #endif /* CPM */