c - Does the C99 standard permit assignment of a variable to itself? -
does c99 standard allow variables assigned themselves? instance, following valid:
int = 42; /* case 1 */ = a; /* case 2 */ int *b = &a; = *b;
while suspect case 1 valid, i'm hesitant same case 2.
in case of assignment, right side evaluated before assigning value variable on left -- or race condition introduced when dereferencing pointer variable being assigned?
both cases valid, since value of a
used determine value stored, not determine object in value store.
in essence in assignment have distinguish 3 different operations
- determine object value stored
- evaluate rhs
- store determined value in determined object
the first 2 of these 3 operations can done in order, in parallel. third consequence of 2 others, come after.
Comments
Post a Comment