Maybe the following text from the Compaq C programmer's manual on
types will be helpful:

2.7  Compatible and Composite Types

  Compatibility between types refers to the similarity of two
  types to each other.  Type compatibility is important during
  type conversions and operations.  All valid declarations in the
  same scope that refer to the same object or function must
  have compatible types.  Two types are compatible if they fit
  any of the following categories:

  *   Two types are compatible if they are the same.

  *   Two qualified types (see Section 3.7) are compatible if they
      are identically qualified and the two types, unqualified,
      are compatible.  The order of the qualifiers in the type
      declaration does not matter.

  *   The types  short,signed short , short int, and signed short
      int are the same and are compatible.

  *   The types  unsigned short  and unsigned short int  are the
      same and are compatible.

  *   The types  int,signed , and signed int are the same and
      are compatible.

  *   The types  unsigned and  unsigned int  are the same and
      are compatible.

  *   The types  long,signed long ,long int ,signed long int  are
      the same and are compatible.

  *   The types  unsigned long  and unsigned long int  are the
      same and are compatible.

  *   Two array types are compatible if they are of the same
      size and contain elements of compatible types.  If one ar-
      ray has an unknown size, it is compatible with all other
      array types having compatible element types.

  *   Two unions or structures are compatible if they are de-
      clared in different compilation units, share the same
      members in the same order, and whose members have
      the same widths (including bit fields).

  *   Two enumerations are compatible if all members have
      the same values.  All enumerated types are compatible
      with other enumerated types.  An enumerated type is also
      compatible with the  signed int  type.

  *   Two pointer types are compatible if they are identically
      qualified and point to objects of compatible types.

  *   A function type declared using the old-style declaration
      (such as int tree( )) is compatible with another function
      type if the return types are compatible.

  *   A function type declared using the new prototype-style
      declaration (such as  int tree (int x)) is compatible with
      another function type declared with a function prototype
      if:

      -   The return types are compatible.

      -   The parameters agree in number (including an ellipsis
          if one is used).

      -   The parameter types are compatible.  For each pa-
          rameter declared with a qualified type, its type for
          compatibility comparison is the unqualified version of
          the declared type.

  *   The function type of a prototype-style function declara-
      tion is compatible with the function type of an old-style
      function declaration if the return types are compati-
      ble, and if the old-style declaration is not a definition.
      (Different styles of function declarations are discussed in
      Chapter 5.)  Otherwise, the function type of a prototype-
      style function declaration is compatible with the function
      type of an old-style function definition if all of the follow-
      ing conditions are met:

      -   The return types of the two functions are compatible.

      -   The number of parameters agree.

      -   The prototype-style function declaration does not
          contain an ellipsis as a parameter.

      -   The promoted types of the old-style parameters are
          compatible with the prototype-style parameter types.

          In the following example, the functions  tree  and tree2
          are compatible.  tree and  tree1 are not compatible,
          and tree1  and tree2  are not compatible.

          int  tree  (int);
          int  tree1  (char);
          int  tree2  (x)
             char  x;    /*  char  promotes  to  int  in  old-style
                           function  parameters,  and  so  is
                           compatible  with  tree              */
             {
             ...
             };

  The following types, which may appear to be compatible, are
  not:

  *   unsigned int and  int types are not compatible.

  *   char,signed char , and unsigned char  types are not com-
      patible.

  Composite Type

  A composite type  is constructed from two compatible types
  and is compatible with both of the two types.  Composite types
  satisfy the following conditions:

  *   If one type is an array of known size, the composite
      type is an array of that size.  Otherwise, if one type is a
      variable-length array, the composite type is that type.

  *   If only one type is a function type with a prototype, the
      composite type is a function type with the parameter type
      list.

  *   If both types are functions types with prototypes, the type
      of each parameter in the composite parameter type list is
      the composite type of the corresponding parameters.

  Consider the following file-scope declarations:

  int  f(int  (*)  (),  double  (*)  [3]);
  int  f(int  (*)  (char  *),  double  (*)[]);

  They result in the following composite type for the function:

  int  f(int  (*)  (char  *),  double  (*)[3]);

  The previous composite type rules apply recursively to types
  derived from composite types.



    Jeffrey Altman * Sr.Software Designer * Kermit-95 for Win32 and OS/2
                 The Kermit Project * Columbia University
              612 West 115th St #716 * New York, NY * 10025
  http://www.kermit-project.org/k95.html * [EMAIL PROTECTED]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to