ポインタ
Posted: 2015年2月06日(金) 22:16
N3337 5.3.1 Unary operatorsより引用A value of integral type or enumeration type can be explicitly converted to a pointer. A pointer converted
to an integer of sufficient size (if any such exists on the implementation) and back to the same pointer type
will have its original value; mappings between pointers and integers are otherwise implementation-defined.
N3337 5.17 Assignment and compound assignment operatorsより引用The unary * operator performs indirection: the expression to which it is applied shall be a pointer to an
object type, or a pointer to a function type and the result is an lvalue referring to the object or function
to which the expression points. If the type of the expression is “pointer to T,” the type of the result is “T.”
2行目は0x12345678を処理系で定義された写像でDWORD型のデータを指すポインタに変換したポインタが指すデータの値を0x02に書き換える、という意味になります。1. The assignment operator (=) and the compound assignment operators all group right-to-left. All require a
modifiable lvalue as their left operand and return an lvalue referring to the left operand. The result in all
cases is a bit-field if the left operand is a bit-field. In all cases, the assignment is sequenced after the value
computation of the right and left operands, and before the value computation of the assignment expression.
With respect to an indeterminately-sequenced function call, the operation of a compound assignment is
a single evaluation.
(中略)
2 In simple assignment (=), the value of the expression replaces that of the object referred to by the left
operand.
本当ですか。それなら、ccさんの環境ではDWORD型の0x12345678は値0x123456789を持つポインタにマップされるようですね。