[mod.std.c] mod.std.c Digest V16#5

osd@hou2d.UUCP (Orlando Sotomayor-Diaz) (05/11/86)

From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Sat, 10 May 86       Volume 16 : Issue   5

Today's Topics:
 Differences from April 1985 to February 1986 Draft Standard, Part 4
----------------------------------------------------------------------

Date: Sun, 27 Apr 86 01:17:06 est
From: <ihnp4!utcsri!lsuc!msb%utcsri>
Subject: Differences from April 1985 to February 1986 Draft Standard, Part 4
To: cbosgd!std-c%utcsri

# C.2.1.2 Signed and unsigned integers

  *    When a signed integer is {assigned to, or  used  as  one  of  the
       operands  of  a binary operator the other operand of which is -->
       converted to} an unsigned integer of  equal  or  greater  length,
  *    {-->  if  the  value  of  the signed integer is non-negative, its
       value is  unchanged.   Otherwise,  if  the  unsigned  integer  is
  *    longer,}  the signed integer is first {converted --> promoted} to
  *    a signed integer of the same length as the unsigned integer.  {If
       the  value  of the signed integer is negative, the conversion in-
       volves --> Then it is converted to unsigned by} adding to it  the
       largest  number  that  can be represented in the unsigned integer
       type plus one.



# C.2.1.3 Floating and integral

<--O   When a value of floating type is converted to integral  type,  if
<--O   the  result  does  not fit in the space provided, the behavior is
<--O   undefined.  When a positive value is converted to  integral,  the
<--O   fractional part is discarded.  When a negative value is converted
<--O   and the value cannot be represented exactly, the result is one of
<--O   the  two  nearest  integers,  chosen in an implementation-defined
<--O   manner.

N-->   When a value of floating type is converted to integral type,  the
N-->   fractional  part is discarded.  If the result does not fit in the
N-->   space provided, the behavior is undefined.



# C.2.1.5 Usual arithmetic conversions

  *    ...  The purpose is to yield a common type, which is  {-->  also}
       the type of the result.

  *    ...  Otherwise, if {only one --> either} operand has type  float,
  *    the  other operand is converted to float.  {(The presence of this
       conversion is implementation-defined.  In  its  absence,  if  one
       operand  has  type float, both operands are converted to double.)
       -->}

  *    ...  Otherwise, both operands {and the result -->} have type int.

N-->   Operands may be converted to other types, provided neither  range
N-->   nor  precision  is  lost  thereby;  the type of the result is not
N-->   changed thereby.  Conversion of  an  operand  to  the  same  type
N-->   causes no change.









# C.2.2.1 Arrays, functions and pointers

  *    Except when used as {the operand of the sizeof  operator  -->  an
       operand that may or shall be an lvalue,} or when a string literal
       is used to initialize an array of chars, an expression  that  has
       type  "array of TYPE" is converted to an expression that has type
       "pointer to TYPE" and that points to the initial  member  of  the
       array object.

  *    {--> Except when used as an operand that may or shall be a  func-
       tion  locator,}  an  identifier  declared  as "function returning
       TYPE" is converted to an expression that  has  type  "pointer  to
       function returning TYPE".

  *    Forward references: {function calls (#C.3.2.2)  -->  lvalues  and
  *    function  locators  (#C.3.0.1)},  initialization  (#C.5.6) {, the
       sizeof operator (#C.3.3.4) -->}.



# C.2.2.2 void

  *    The (nonexistent) value of a {void expression -->  "void  expres-
       sion" (an expression that has type void)} must not be used in any
       way, and explicit or implicit conversions must not be applied  to
  *    such {a value --> an expression}.

Remark: Another change that applies throughout the document.



# C.2.2.3 Pointers

<--O   An integral constant expression with the value 0 may be  assigned
<--O   to or compared for equality to a pointer.  The integer constant 0
<--O   is converted to  a  pointer  of  the  appropriate  type  that  is
<--O   guaranteed  not to point to any object.  Such a pointer, called a
<--O   "null pointer", must appear to be equal to the  integer  constant
<--O   0.

N-->   An integral constant expression with the value 0 or such  an  ex-
N-->   pression cast to type void * is called a "null pointer constant".
N-->   If a null pointer constant is assigned to or compared for equali-
N-->   ty  to  a pointer, the constant is converted to a pointer of that
N-->   type.  Such a pointer, called a "null pointer", is guaranteed not
N-->   to point to any object or function.



# C.2.2.4 const and volatile

N-->   The properties associated with the const type specifier are mean-
N-->   ingful only for expressions that are lvalues.

       An expression that has  a  type  declared  with  the  const  type
  *    specifier shall not be {an --> a modifiable} lvalue.

Remark: The above does not reflect a change in the  language  but
rather a change in the meaning of the term "lvalue".  See...

  *    ...  Forward references: ...  {--> lvalues and function  locators
       (#C.3.0.1)}.



# C.2.2.4 const and volatile

  *    {The address of a const object may -->  Except  via  an  explicit
       cast, an expression that has type "pointer to type with the const
       attribute" shall not} be assigned to a pointer to a type  without
  *    the  const attribute.  If an attempt is made to {change the value
       --> modify an object that has a type declared with the const type
       specifier by means of an lvalue that has a type not declared with
       the const type specifier}, the behavior is undefined.

Remark: And likewise for volatile, except the paragraph for vola-
tile does not use the word "attempt".



# C.3 EXPRESSIONS

       An "expression" is a sequence  of  operators  and  operands  that
  *    specifies  how  to compute a value {--> or (in the case of a void
       expression) how to generate side effects}.



# C.3 EXPRESSIONS

       Except as indicated by the syntax or  otherwise  specified  later
  *    (for  the  function-call  operator (), {--> the unary plus opera-
       tor,} &&, ||, ?:, and comma operators), the order  of  evaluation
       of an expression is unspecified.



# C.3 EXPRESSIONS

       To force  a  particular  grouping  of  operations  ...   grouping
  *    parentheses may be preceded by a unary plus {or minus -->} opera-
       tor.



# C.3 EXPRESSIONS

       The syntax specifies the precedence of operators in  the  evalua-
       tion  of an expression, which is the same as the order of the ma-
       jor subsections of this section, highest precedence  first.   ...
  *    {The only exceptions are unary operators (#C.3.3), which may have
       cast expressions (#C.3.4) as operands.  -->  The  exceptions  are
       cast   expressions   (#C.3.4)  as  operands  of  unary  operators
       (#C.3.3), and an operand contained between any of  the  following
       pairs  of operators: grouping parentheses () (#C.3.1), subscript-
       ing  brackets  []  (#C.3.2.1),   function-call   parentheses   ()
       (#C.3.2.2), and the conditional operator ?: (#C.3.15).}

------------------------------

End of mod.std.c Digest - Sat, 10 May 86 18:53:53 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.