1

最近、古い試験で次の JML コードを読みました。

Class L {
  /*@non_null*/ int[] a;

  /*@ public normal_behaviour
    @ requires !(\exists int i; 0 <= i && i < a.length; a[i] == d);
    @ ensures a.length == \old(a.length) + 1;
    @ ensures a[\old(a.length)] == d;
    @ ensures (\forall int i; 0 <= i && i < \old(a.length);
                  a[i] == \old(a[i]));
    @ assignable a, a[*];
    @*/
  public void st(int d) {
      ...
  }
}

私は理解していません

assignable a, a[*];

部。とはa[*]どういう意味ですか? だけだったら何が違うだろう

assignable a;

?

(参照へのリンクは素晴らしいでしょう。)

4

1 に答える 1

1

の assignable 句は、次の場合にJMLのみメソッドがロケーション loc を変更できるようにします。

- loc is mentioned in the method’s assignable clause;
- loc is not allocated when the method starts execution; or
- loc is local to the method (i.e., a local variable or a formal parameter)

の使用は¹a[*]の省略形です[0 ... a.length-1];

詳細情報| 引用文献

于 2015-03-04T06:08:35.193 に答える