COHERENT manpages

This page displays the COHERENT manpage for C language [Overview].

List of available manpages
Index


C language -- Overview

COHERENT  includes a  C compiler  that fully  implements the  Kernighan and
Ritchie standard of C, with extensions taken from the ANSI standard.

Please note  that in the following discussion, word  indicates an object 16
bits long;  dword, an  object 32  bits long; and  qword, an object  64 bits
long:

Identifiers
     Characters allowed: A-Z, a-z, _, 0-9
     Case sensitive
     Number of significant characters in a variable name: 255

Escape Sequences
     The COHERENT C compiler recognizes the following escape sequences:

          ASCII   Ctrl         Hex         Description
     \a   BEL     <ctrl-G>           0x07audible tone (bell)
     \b   BS      <ctrl-H>           0x08backspace
     \f   FF      <ctrl-L>           0x12formfeed
     \n   LF      <ctrl-J>           0x0Alinefeed (newline)
     \r   CR      <ctrl-M>           0x0Dcarriage return
     \t   HT      <ctrl-I>           0x09horizontal tab
     \v   VT      <ctrl-K>           0x0Bvertical tab
     \xhh                     0xhh         hex (one to four hex digits [0-9a-fA-F])
     \ooo                                  octal (one to four octal digits [0-7])

Trigraphs
     The COHERENT C compiler recognizes the following trigraphs:

           Trigraph  Character
           Sequence Represented

              ??=        #
              ??(        [
              ??/        \
              ??)        ]
              ??'        ^
            ??<       {
              ??!        |
            ??>       }
              ??-        ~

     For details, see the Lexicon entry trigraph.

Reserved Identifiers (Keywords)
     See the Lexicon entry for C keywords.

Data Formats (in bits)

          char              8
          unsigned char     8
          double            64
          enum              8|32
          float             32
          int               32
          unsigned int      32
          long              32
          unsigned long     32
          pointer           32
          short             16
          unsigned short    16

Floating-Point Formats

     IEEE floating-point float:
         1 sign bit
         8-bit exponent
         24-bit normalized fraction with hidden bit
         Bias of 127

     IEEE floating-point double:
         1 sign bit
         11-bit exponent
         53-bit fraction
         Bias of 1,023

     Reserved values:
         +- infinity, -0

     All floating-point operations are done as doubles.

Limits
     Maximum bitfield size:  32 bits
     Maximum number of cases in a switch:  no formal limit
     Maximum number of arguments in function declaration:  32
     Maximum number of arguments in function call:  no formal limit
     Maximum block nesting depth:  no formal limit
     Maximum parentheses nesting depth:  no formal limit
     Maximum structure size:  no formal limit
     Maximum array size:  no formal limit

Preprocessor Instructions

          #define     #ifdef
          #else       #ifndef
          #elif       #include
          #endif      #line
          #if         #undef
          #pragma

Structure Name-Spaces
     Supports both Berkeley and Kernighan-Ritchie conventions for structure
     in union.

Function Linkage
     Return values in EAX
     Return values for doubles:
         With software floating-point emulation returns in EDX:EAX
         Hardware floating-point (-VNDP) returns in the NDP stacktop %st0
     Parameters pushed on stack in reverse order:
         chars, shorts, and pointers pushed as dwords
         Structures copied onto the stack
     Caller must clear parameters off stack
     Stack frame linkage is done through ESP register

Structures and Alignment
     Structure members  are aligned according to  the most strictly aligned
     type within  the structure.  For example,  a structure is word-aligned
     if it  contains only  shorts, but  on dword if  it contains an  int or
     long.  #pragma align n can override this feature.

Registers
     Registers  EBX, EDI,  and ESI  are  available for  register variables.
     Only 32-bit objects go into registers.

Special Features and Optimizations

Both implementations of C perform the following optimizations:

-> Branch  optimization  is   performed:  this  uses  the  smallest  branch
   instruction for the required range.

-> Unreached code is eliminated.

-> Duplicate instruction sequences are removed.

-> Jumps to jumps are eliminated.

-> Multiplication and  division by  constant powers  of two are  changed to
   shifts when the results are the same.

-> Sequences  that  can be  resolved  at compile  time  are identified  and
   resolved.

Compilation Environments

COHERENT  supports a  number  of different  compilation environments.   For
example, you can compile a program to use the environment for UNIX System V
release  4 or  release 3,  or the  Berkeley environment.   This is  done by
setting manifest  constants on  your C  compiler's command line,  which, in
turn, invokes  various settings within the header  files.  For details, see
the Lexicon entry for header files.

Example

The following gives an example C program, which does something interesting.
It was writen by Charles Fiterman:

    char *x="char *x=%c%s%c;%cmain(){printf(x,34,x,34,10,10);}%c";
    main(){printf(x,34,x,34,10,10);}

See Also

argc,
argv,
C keywords,
C preprocessor,
environ,
envp,
header files,
initialization,
libraries,
main(),
name space,
offsetof(),
Programming COHERENT,
trigraph