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] Why 2.27 released
- Subject: [Frama-c-discuss] Why 2.27 released
- From: pascal.cuoq at gmail.com (Pascal Cuoq)
- Date: Fri, 15 Oct 2010 15:45:38 +0200
- In-reply-to: <4CB84D07.3070004@inria.fr>
- References: <4CB6C304.7@inria.fr> <395817668.6335.1287058251768.JavaMail.root@zmbs1.inria.fr> <4CB84D07.3070004@inria.fr>
> while(low <= high) { > ? ?//@ ensures low <= mid <= high; ? // this is the new annotation suggested > ? ?mid = low + (high - low) / 2; > > [...] the cut says > that it should not bother with this division: any other computation giving a > number between low and high would > make the program correct. This is a very interesting remark. If I understand correctly, it means I can make up an interpolation formula, and as long as I can prove that the interpolation part itself does not divide by zero or return an index out of the low..high range, I will get a verified interpolation search. This example has the potential to become my favorite illustration for advantages of design-by-contract. Probably with the computation of mid moved to a function, though, since the "statement contract" syntax confuses people at first (for instance, here, "ensures low <= mid <= high" is a contract on statement "mid = low + (high - low) / 2;". The property therefore applies just after this statement). Pascal
- References:
- [Frama-c-discuss] Why 2.27 released
- From: Claude.Marche at inria.fr (Claude Marche)
- [Frama-c-discuss] Why 2.27 released
- From: Claude.Marche at inria.fr (Claude Marche)
- [Frama-c-discuss] Why 2.27 released
- Prev by Date: [Frama-c-discuss] Why 2.27 released
- Next by Date: [Frama-c-discuss] Why 2.27 released
- Previous by thread: [Frama-c-discuss] Why 2.27 released
- Next by thread: [Frama-c-discuss] Why 2.27 released
- Index(es):