HP 3000 Manuals

Practices to Avoid [ HP C Programmer's Guide ] MPE/iX 5.0 Documentation


HP C Programmer's Guide

Practices to Avoid 

To make a program portable, you need to minimize machine dependencies.
The following are programming practices you should avoid to ensure
portability:

   *   Using dollar signs ($) in identifiers.

   *   Using underscores (_) as the first character in an identifier.

   *   Using sized enumerations.

   *   Reliance on implicit expression evaluation order.

   *   Making assumptions regarding storage allocation and layout.

   *   Dependence on the number of significant characters in an
       identifier.  Identifiers should differ as early as possible in the
       name.  ANSI C requires that the first 31 characters of an internal
       name are significant.  Only the first 6 characters of an external
       name are required to be significant by ANSI C.

   *   Dereferencing null pointers.

   *   Dependence on pointer representation.

   *   Dependence on being able to dereference a pointer to an object
       that is not correctly aligned.

   *   Dependence on the ability to store a pointer in a variable of type
       int.

   *   Dependence on case distinctions in external names.

   *   Dependence on char being signed or unsigned.

   *   Dependence on bitwise operations in signed integers.

   *   Dependence on bit-fields of any type except int, unsigned int, or
       signed int.

   *   Dependence on the sign of the remainder in integer division.

   *   Dependence on right shifts of negative signed values.

   *   Dependence on more than six declarators modifying a basic type.

   *   Dependence on values of automatic variables after a longjmp call
       when the values were changed between the setjmp and longjmp calls.

   *   Dependence on being able to call setjmp within an arbitrarily
       complex expression.

   *   Dependence on file system characteristics.

   *   Dependence on string literals being modifiable.

   *   Dependence on extern declarations within a block being visible
       outside of the block.



MPE/iX 5.0 Documentation