mod.std.c Digest V16#7
Orlando Sotomayor-Diaz
osd at hou2d.UUCP
Sun May 11 21:34:37 AEST 1986
From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>
mod.std.c Digest Sun, 11 May 86 Volume 16 : Issue 7
Today's Topics:
Differences from April 1985 to February 1986 Draft Standard, Part 6
----------------------------------------------------------------------
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 6
To: cbosgd!std-c%utcsri
# C.3.3.3 Unary arithmetic operators
* Except that it inhibits regrouping {--> of subexpressions of E
with subexpressions outside of E}, the expression +E is
equivalent to (0+E).
# C.3.3.4 The sizeof operator
<--O The sizeof operator ... may be applied to any object except a
<--O bit-field member of a structure, which is the only kind of object
<--O whose size might not be an integral number of bytes.
N--> The sizeof operator may not be applied to any expression that has
N--> type function, bit-field, or void, or to the parenthesized name
N--> of the type of such an expression.
# C.3.3.4 The sizeof operator
* The size is determined from the {declaration --> type} of the
* {object in the -->} operand {expression -->}, which is not itself
* evaluated. The result is {an unsigned constant that has integral
type and may be used anywhere such a constant is required --> an
integer constant}. The size of the result is implementation-
* defined {-->, and its type (an unsigned integral type) is size_t
defined in the <stddef.h> header}.
# C.3.3.4 The sizeof operator
* When applied to a formal parameter that has array {--> or func-
* tion} type, the sizeof operator yields the size of {a pointer to
a member of such an array --> the pointer obtained by converting
as in #C.2.2.1}.
# C.3.3.4 The sizeof operator
<--O double *dp = alloc(sizeof (double));
<--O ...
<--O sizeof(array)/sizeof(array[0])
N--> double *dp = alloc(sizeof *dp);
N--> ...
N--> sizeof array / sizeof array[0]
# C.3.3.4 The sizeof operator
* Forward references: ... {--> terms and common definitions
(#D.1.1)}, ...
# C.3.4 Cast operators
* An {--> arbitrary} integer may be converted to a pointer. {If
the space provided was long enough, the mapping always carries an
integer converted from a pointer back to the same pointer, but is
otherwise --> The result is} implementation-defined.
# C.3.4 Cast operators
N--> A cast does not yield an lvalue.
# C.3.6 Additive operators
When two pointers to members of the same array object are sub-
tracted ... the size of the result is implementation-defined
* {-->, and its type (a signed integral type) is ptrdiff_t defined
in the <stddef.h> header}.
# C.3.9 Equality operators
Both of the operands may have arithmetic type, or both may be
* pointers to the same type. In addition, {--> one may be an ob-
ject pointer and the other a pointer to void, or} one may be a
* pointer and the other {an integral constant expression with the
value 0 --> a null pointer constant}.
N--> ... If one of the operands is a pointer to void, the other is
N--> converted to that type.
# C.3.15 Conditional operator
Both the second and third operands shall have arithmetic type, or
shall have the same structure, union, or pointer type, or shall
* be void expressions. In addition, {--> one may be an object
pointer and the other a pointer to void, or} one may be a pointer
* and the other {an integral constant expression with the value 0
--> a null pointer constant}.
N--> ... If one of the operands is a pointer to void, the other
N--> operand is converted to that type and the result has that type.
N--> A conditional expression does not yield an lvalue.
# C.3.16 Assignment operators
* An assignment operator shall have a {--> modifiable} lvalue as
its left operand.
* An assignment operator stores a value in the object {specified by
the lvalue --> designated by the left operand}. An assignment
expression has the type of the left operand and the value of the
* left operand after the assignment {-->, but is not an lvalue}.
# C.3.16.1 Simple assignment
<--O The operands may each have arithmetic type or may be structure or
<--O union objects that have the same type. In addition, the left
<--O operand may be a pointer, in which case the right operand must be
<--O a pointer that has the same type or has type "pointer to void",
<--O or must be an integral constant expression with the value 0.
N--> Both the operands shall have arithmetic type or shall have the
N--> same structure, union, or pointer type. In addition, if the left
N--> operand is a pointer, either of the operands may be a pointer to
N--> void, or the right operand may be a null pointer constant.
* ... If the left operand is a pointer {and the right operand an
integral constant expression with the value 0, the constant is
converted into a null pointer -->, if either of the operands is a
pointer to void or the right operand is a null pointer constant,
the right operand is converted to the type of the left operand}.
# C.3.17 Comma operator
N--> A comma operator does not yield an lvalue.
# C.4 CONSTANT EXPRESSIONS
A function-call operator (), an increment or decrement operator
* ++ or --, {an indirection * unary operator, -->} or an assignment
operator shall not appear in any constant expression.
... The array-subscripting [] and member-access . and -> opera-
* tors and the "address-of" & {--> and indirection *} unary opera-
* tors shall not appear {,--> except in an expression that is the
operand of a sizeof operator}.
<--O For constant expressions in initializers, in addition to integral
<--O constant expressions as discussed previously, one can also use
<--O floating constants and arbitrary casts and can apply the unary &
<--O operator to objects that have static storage duration and to ar-
<--O rays that have static storage duration subscripted with an in-
<--O tegral constant expression. The unary & operation can also be
<--O implied by appearance of a function identifier or an unsubscript-
<--O ed array identifier. In short, the expression must evaluate to a
<--O constant, to the identifier or a previously declared function, or
<--O to the address of a previously declared object that has static
<--O storage duration plus or minus an integral constant expression,
<--O or to the difference in addresses of two previously declared ob-
<--O jects that are members of the same aggregate.
N--> For constant expressions in initializers, in addition to integral
N--> constant expressions as discussed previously, floating constants
N--> and arbitrary casts may be used. Lvalues of objects that have
N--> static storage duration or function identifiers may also be used
N--> to specify addresses, explicitly with the unary & operator or im-
N--> plicitly for unsubscripted array identifiers or function identif-
N--> iers. A constant difference in the addresses of two members of
N--> the same aggregrate may be used. As a special case, a suitably
N--> cast null pointer may be used to derive an integral constant ex-
N--> pression, the value of which is the offset in bytes of an element
N--> of a structure from its beginning, by means of an expression of
N--> the form
N--> (int)&((TYPE-SPECIFIER)0)->POSTFIX-EXPRESSION
N--> where TYPE-SPECIFIER specifies the type of a pointer to a struc-
N--> ture and POSTFIX-EXPRESSION designates any member of that struc-
N--> ture or of a subaggregate (any array subscript shall be an in-
N--> tegral constant expression).
------------------------------
End of mod.std.c Digest - Sun, 11 May 86 07:34:03 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c at BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.
More information about the Mod.std.c
mailing list