Document: WG14 N1510

register has no effect on behaviour


Submitter: Fred J. Tydeman (USA)
Submission Date: 2010-09-xx
Subject: register has no effect on behaviour

I cannot find any normative words that say a register float and auto float have the same precision and range. I can find examples and footnotes, but, they are not normative.

5.1.2.3 Program execution, paragraph 13, example 4 has:

Implementations employing wide registers have to take care to honor appropriate semantics. Values are independent of whether they are represented in a register or in memory. For example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load is required to round to the precision of the storage type. In particular, casts and assignments are required to perform their specified conversion.

6.7.1 Storage-class specifiers, paragraph 5, footnote 119:

The implementation may treat any register declaration simply as an auto declaration.

6.7.3 Type qualifiers, paragraph 7:

The intended use of the restrict qualifier (like the register storage class) is to promote optimization, and deleting all instances of the qualifier from all preprocessing translation units composing a conforming program does not change its meaning (i.e., observable behavior).

Proposal: Add to 6.7.1 Storage-class specifiers, paragraph 5:

Deleting all instances of the register storage class from all preprocessing translation units composing a conforming program does not change its meaning (i.e., observable behavior).

Add to the Rationale

Variables in memory and in registers have the same semantics. In particular, register float and auto float have the same precision and range.