0

4 つのコード フラグメントを次に示します。このコードが明確に定義された動作を生成することが保証されている (または保証されていない) のはなぜですか?

制限された「循環参照」:

struct B;
struct A { struct B *restrict b1, *restrict b2; };
struct B { struct A *restrict a1, *restrict a2; };

外側から内側への代入:

void f1(int *restrict p) {
  {
    int *restrict p2 = p;
    *p2 = 0;
  }
}

関数に渡す:

static inline void f2helper(int *restrict p) {
  *p = 0;
}
void f2(int *restrict p) {
  f2helper(p);
}

ポインター演算ループ:

void f3(int *restrict p, size_t s) {
  int * p2 = p + s;
  while (p2 > p)
    *--p2 = 0;
}
4

1 に答える 1