Going forward, but gently...
This commit is contained in:
parent
4a30965654
commit
97a81f159a
4 changed files with 36 additions and 8 deletions
|
@ -318,6 +318,9 @@ int abs2(int n)
|
|||
/*@
|
||||
loop assign i, min, max;
|
||||
*/
|
||||
while ( i < n )
|
||||
{
|
||||
// ...
|
||||
\end{lstlisting}
|
||||
\end{solutionorbox}
|
||||
|
||||
|
@ -343,7 +346,14 @@ int max_dist(int *tab, unsigned int n)
|
|||
|
||||
|
||||
\begin{solutionorbox}
|
||||
METTEZ VOTRE RÉPONSE ICI.
|
||||
Cette fonction incorrecte prend en paramètre deux éléments -- un tableau et un entier positif -- et en retrourne un -- un entier. C'est exactement la même chose que pour notre fonction correcte. Le contrat s'écrirait alors comme ci-dessous pour Frama-C :
|
||||
\begin{lstlisting}
|
||||
\*@
|
||||
require 0 < n <= UINT_MAX;
|
||||
require \valid(tab+(0..n-1));
|
||||
ensures \result >= 0;
|
||||
*\
|
||||
\end{lstlisting}
|
||||
\end{solutionorbox}
|
||||
|
||||
\part Donnez une postcondition vérifiée par la fonction correcte qui n’est pas vérifiée par celle-ci.
|
||||
|
@ -351,7 +361,7 @@ int max_dist(int *tab, unsigned int n)
|
|||
|
||||
|
||||
\begin{solutionorbox}
|
||||
METTEZ VOTRE RÉPONSE ICI.
|
||||
|
||||
\end{solutionorbox}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue