------------------------------- Page    i -------------------------------

                             Notes on UTS C

------------------------------- Page   ii -------------------------------

                            TABLE OF CONTENTS


1.    Introduction  . . . . . . . . . . . . . . . . . . . . . . . . .   1

2.    New Features from Version 7 . . . . . . . . . . . . . . . . . .   1

2.1      Structure Assignment . . . . . . . . . . . . . . . . . . . .   1
2.2      Enumeration Type . . . . . . . . . . . . . . . . . . . . . .   1

3.    UTS Differences . . . . . . . . . . . . . . . . . . . . . . . .   2

3.1      External Names . . . . . . . . . . . . . . . . . . . . . . .   3
3.2      Unsigned Short Integers  . . . . . . . . . . . . . . . . . .   3
3.3      Long Integers  . . . . . . . . . . . . . . . . . . . . . . .   3
3.4      Bit Fields . . . . . . . . . . . . . . . . . . . . . . . . .   3


                                                            Last Page   3

-------------------------------- Page  1 --------------------------------

1.    INTRODUCTION

This document describes the  differences between the  UTS C language  and
the C language as described in the C book ("The  C Programming Language,"
Kernighan and Ritchie, Prentice-Hall, 1978).

There are two types of differences: those that were introduced by version
7 of UNIX- and those that were introduced by UTS.




2.    NEW FEATURES FROM VERSION 7

The information in this section is stolen from "Recent Changes to C",  an
addendum to "The C Programming Language -- Reference Manual" in the "UNIX
Programmer's Manual", Seventh Edition, Volume 2A.


2.1      STRUCTURE ASSIGNMENT

Structures may  be  assigned,  passed  as  arguments  to  functions,  and
returned by functions.  The  types of the  operands taking part in  these
operations must be the same.  Structures may be used with comma operators
and as the  second and  third operands of  conditional operators.   Other
plausible operators, such as  equality comparison, have  not been  imple-
mented, and there is no notation for a structure constant.


2.2      ENUMERATION TYPE

There is a new data type analogous to the scalar types of Pascal.  To the
type-specifiers in the syntax on page 193 of the C book add

     enum-specifier

with syntax




_______________
  -UNIX is a trademark of Bell Laboratories.

-------------------------------- Page  2 --------------------------------

     enum-specifier:
          enum { enum-list }
          enum identifier { enum-list }
          enum identifier

     enum-list:
          enumerator
          enum-list , enumerator

     enumerator:
          identifier
          identifier = constant-expression

The role of the identifier in the enum-specifier is entirely analogous to
that of the structure  tag in a  struct-specifier; it names a  particular
enumeration.  For example,

     enum color { chartreuse, burgundy, claret, winedark };
     ...
     enum color *cp, col;

makes color  the enumeration-tagenum-list  of a  type describing  various
colors, and then declares cp as a pointer to an  object of that type, and
col as an object of that type.

The identifiers  in the  enum-list  are declared  as constants,  and  may
appear where constants are  required.  If no  enumerators with =  appear,
then the values of  the constants begin  at 0  and increase by  1 as  the
declaration is read from left  to right.  An enumerator with = gives  the
associated identifier the  value indicated;  subsequent identifiers  con-
tinue the progression from the assigned value.

Enumeration tags and constants must  all be distinct, and, unlike  struc-
ture tags and members, are  drawn from the same set as ordinary  identif-
iers.

Objects of a given enumeration  type are regarded as  having a type  dis-
tinct from objects of  all other types,  and lint flags type  mismatches.
Enumeration variables are  implemented and  behave as if  they were  type
int.




3.    UTS DIFFERENCES

Most details of the UTS C compiler are the same as described in the  book
for IBM 370 C compilers.   The only differences are with external  names,

-------------------------------- Page  3 --------------------------------

unsigned short integers, long integers, and bit fields.


3.1      EXTERNAL NAMES

External names may be 8 characters long and upper and lower case are dis-
tinct.  PDP-11 UNIX allows  only 7 character  externals; C compilers  for
IBM systems treat upper and lower cases identically.


3.2      UNSIGNED SHORT INTEGERS

The type unsigned short  is allowed.   It is a  16-bit (2-byte)  quantity
with values between 0  and 65535.  Unsigned  shorts are converted to  int
before participating in any arithmetic expression.


3.3      LONG INTEGERS

Long integers are 64-bit (8-byte)  quantities.  Static or external  longs
are aligned on double-word boundaries.


3.4      BIT FIELDS

Bit fields may be of types short and char as  well as int.  The types  of
bit fields affect the size and alignment of the structure  containing the
fields, as  well as  determining the  maximum size  of the  fields.   For
instance,

     struct {
             int nib1 : 4;
             int nib2 : 4;
     } frog;

defines two contiguous 4-bit fields, but  the structure frog is one  word
long and will be aligned on a word boundary, because  the fields are type
int.  What is probably wanted is

     struct {
             char nib1 : 4;
             char nib2 : 4;
     } frog;

which causes frog to be one byte long with byte alignment.
