10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

16.1.9 Operators ++ and -- DEFINITE ASSIGNMENT<br />

536<br />

• V is [un]assigned before a iff V is [un]assigned before the assignment expression.<br />

• V is [un]assigned before b iff V is [un]assigned after a.<br />

Note that if a is V and V is not definitely assigned before a compound assignment<br />

such as a &= b, then a compile-time error will necessarily occur. <strong>The</strong> first<br />

rule for definite assignment stated above includes the disjunct “a is V ” even for<br />

compound assignment expressions, not just simple assignments, so that V will be<br />

considered to have been definitely assigned at later points in the code. Including<br />

the disjunct “a is V ” does not affect the binary decision as to whether a program is<br />

acceptable or will result in a compile-time error, but it affects how many different<br />

points in the code may be regarded as erroneous, and so in practice it can improve<br />

the quality of error reporting. A similar remark applies to the inclusion of the conjunct<br />

“a is not V ” in the first rule for definite unassignment stated above.<br />

16.1.9 Operators ++ and --<br />

• V is definitely assigned after ++a, --a, a++,ora-- iff either a is V or V is definitely<br />

assigned after the operand expression.<br />

• V is definitely unassigned after ++a, --a, a++, ora-- iff a is not V and V is<br />

definitely unassigned after the operand expression.<br />

• V is [un]assigned before a iff V is [un]assigned before ++a, --a, a++, or a--.<br />

16.1.10 Other Expressions<br />

Driftwood: All right. It says the, uh, the first part of the party<br />

of the first part, should be known in this contract<br />

as the first part of the party of the first part,<br />

should be known in this contract . . .<br />

Night at the Opera<br />

DRAFT<br />

If an expression is not a boolean constant expression, and is not a preincrement<br />

expression ++a, predecrement expression --a, postincrement expression a++,<br />

postdecrement expression a--, logical complement expression !a, conditionaland<br />

expression a && b, conditional-or expression a || b, conditional expression a<br />

? b : c, or assignment expression, then the following rules apply:<br />

• If the expression has no subexpressions, V is [un]assigned after the expression<br />

iff V is [un]assigned before the expression. This case applies to literals,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!