Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] adjacent_find problem



> By typing your predicate as accepting an int, you forced a
> cast to be applied to its argument each time the argument is
> of type integer.

To clarify, "i+1" is of type "integer" because "+" takes two integers
and returns an integer. The int "i" it silently promoted to "integer"
in order to apply "+" to it, but the type-checker refuses to convert the
result to the int expected by have_equal_neighbours because this
could lose information.

/*@
  predicate
    have_equal_neighbours{Label}(int* a, int n) =
...
*/
...
    loop invariant !have_equal_neighbours(a, i+1);
...

Pascal