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

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

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


mod.std.c Digest            Sun, 11 May 86       Volume 16 : Issue   6

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

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 5
To: cbosgd!std-c%utcsri

# C.3.0.1 Lvalues {--> and function locators}

  *    An "lvalue" is an expression that designates an object {and  that
  *    may  be  used  to  change its value -->}.  {--> When an object is
       said to have a particular type, the  type  is  specified  by  the
       lvalue used to designate the object.}

N-->   If an lvalue appears in a context other than as an  operand  that
N-->   may  or  shall be an lvalue, if it has array type it is converted
N-->   to a pointer as described in #C.2.2.1, otherwise it  is  replaced
N-->   by  the  value  of  the  designated  object.  In either case, the
N-->   result is not an lvalue.

N-->   A "modifiable lvalue" is an lvalue that does not have array  type
N-->   and does not have a type declared with the const type specifier.

N-->   A "function locator" is an expression that has function type.  If
N-->   a  function locator appears in a context other than as an operand
N-->   that may or shall be a function locator, it  is  converted  to  a
N-->   pointer  as  described in #C.2.2.1.  The result is not a function
N-->   locator.

  *    {Some operators yield lvalues. -->} The discussion of each opera-
  *    tor  {states if it expects --> identifies those that may or shall
  *    have an lvalue {-->,  modifiable  lvalue,  or  function  locator}
  *    operand, and {if it --> those that} yield an lvalue {--> or func-
       tion locator} result.

  *    ...  The name "lvalue" comes {--> originally} from the assignment
       expression  E1 = E2,  in  which  the  left  operand E1 must be an
  *    lvalue.  {--> It is perhaps better considered as representing  an
       object  "locator value".  What is sometimes called "rvalue" is in
       this Standard described as the "value of an expression".}

  *    An obvious example of an lvalue is an  identifier  {used  on  the
       left  side  of  an  assignment  operator --> of an object}.  As a
       further example, if E is a  unary  expression  that  has  pointer
       type,  *E  is  an  lvalue  that  designates the object to which E
       points.



# C.3.1 Primary expression

<--O   An identifier is a primary expression, provided it has been suit-
<--O   ably  declared  as discussed later.  Its type is specified by its
<--O   declaration, except for the conversions of function and array ex-
<--O   pressions  discussed  previously.   Because of these conversions,
<--O   function and array identifiers are not lvalues.

N-->   An identifier is a primary expression, provided it has  been  de-
N-->   clared as an object (in which case it is an lvalue) or a function
N-->   (in which case it is a function locator).

       A constant is a primary expression.   Its  type  depends  on  its
  *    form, as detailed {previously --> in #C.1.1.3}.

<--O   A string literal is a primary expression.  Its type is originally
<--O   "array of const char"; following the conversion rule given previ-
<--O   ously for arrays, this is converted to "pointer  to  const  char"
<--O   and  the  result  is  a  pointer  to the initial character in the
<--O   string literal.

N-->   A string literal is a primary expression.  It  is  an  lvalue  of
N-->   type "array of char", as detailed in #C.1.1.4.

  *    A parenthesized expression is a primary  ...   {The  presence  of
       parentheses  does not affect whether the expression is an lvalue.
       --> It is an lvalue if the unadorned expression is an lvalue,  or
       a  function locator if the unadorned expression is a function lo-
       cator.}



# C.3.2.1 Array subscripting

<--O   Usually,  the  first  expression  has  type   "array   of   TYPE"
<--O   (equivalently,  "pointer  to  TYPE"),  the subscript has integral
<--O   type, and the type of the result is "TYPE".

N-->   One of the expressions shall have type  "pointer  to  TYPE",  the
N-->   other  expression  shall  have  integral type, and the result has
N-->   type "TYPE".



# C.3.2.1 Array subscripting

  *    If E is an n-dimensional array ...  then E, {appearing in an  ex-
       pression  -->  used  as  other than an lvalue}, is converted to a
       pointer to an (n-1)-dimensional array ...  If the unary *  opera-
       tor  is  applied  to  this pointer explicitly, or implicitly as a
       result of subscripting,  the  result  is  the  pointed-to  (n-1)-
  *    dimensional  array, which is itself {immediately converted into a
       pointer --> converted into a pointer if used  as  other  than  an
       lvalue}.



# C.3.2.2 Function calls

  *    The {first expression --> expression preceding  the  parentheses}
  *    shall  have  type  {"function returning TYPE" or -->} "pointer to
  *    function returning TYPE" {--> (which could be the result of  con-
       verting a function locator)}.



# C.3.2.2 Function calls

N-->   If a function prototype declarator is in scope, the number of ar-
N-->   guments  shall  agree  with the number of formal parameters.  The
N-->   types shall be such that each formal parameter  may  be  assigned
N-->   the value of the corresponding argument.



# C.3.2.2 Function calls

  *    An argument may be {a function identifier or an  expression  that
       has  the  type of any object --> any expression other than a void
       expression}.  In preparing for the call to a function, each argu-
  *    ment  is  {assigned  to the corresponding formal parameter; thus,
       all argument passing is strictly by value --> evaluated, and each
       formal parameter is assigned the value of the corresponding argu-
       ment}.

  *    ...  If no {"function prototype" (a declaration that declares the
       types of the parameters) --> function prototype declarator} is in
       scope, the integral promotions are performed, and arguments  that
  *    have  type  float  are promoted to double.  {--> These are called
       the "default argument conversions".  If the number  of  arguments
       or  their  types  after conversion do not agree with those of the
       formal parameters, the behavior is undefined.}



# C.3.2.3 Structure and union members

       A postfix expression followed by a dot and an  identifier  desig-
  *    nates  a member of a structure or union {object --> entity}.  The
  *    value ... is an lvalue {if the first expression is an lvalue  and
       the  type of the member is not array or a type with the const at-
       tribute --> unless the first expression is the value returned  by
       a function call}.

       A postfix expression followed by an arrow ...  and an  identifier
       designates  a  member  of a structure or union object.  The value
  *    ... is an lvalue {if the type of the member is  not  array  or  a
       type with the const attribute -->}.

<--O   ...  If f is a function returning a structure or union, and x  is
<--O   a member of that structure of union, f().x is a valid postfix ex-
<--O   pression but is not an lvalue.



# C.3.2.4 Postfix increment and decrement operators

  *    The operand ... shall be a {--> modifiable} lvalue.  ...



# C.3.3.1 Prefix increment and decrement operators

  *    The operand ... shall be a {--> modifiable} lvalue.  ...



# C.3.3.2 Address and indirection operators

N-->   The operand of the unary & operator shall be a  function  locator
N-->   or  an lvalue that designates an object other than a bit-field or
N-->   an object declared with the register storage-class specifier.

  *    The operand of the unary * operator shall have pointer type {-->,
       other than pointer to void.}



# C.3.3.2 Address and indirection operators

       The unary * operator denotes indirection.  If the operand  points
  *    to a function, the result is {an expression by which the function
       can be called --> a function locator}; ...



# C.3.3.2 Address and indirection operators

  *    It is always true that if E is an lvalue {--> or  function  loca-
  *    tor}, *&E is an lvalue {--> or function locator} equal to E.

  *    If *P is an lvalue and T is the name of an {-->  object}  pointer
       type,  the  cast  expression *(T)P is an lvalue that has the same
       type as that to which T points.

  *    Forward references: cast operators (#C.3.4)  {-->,  storage-class
       specifiers (#C.5.1), structure and union specifiers (#C.5.2.1)}.

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

End of mod.std.c Digest - Sun, 11 May 86 07:27:01 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.