|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> On 8/5/2011 8:08, Warp wrote:
> > Darren New<dne### [at] san rr com> wrote:
> >> (What would an invariant look like in C?)
> >
> > I suppose the closest thing is "assert(a< b);"
> That's not really an invariant, tho. C basically doesn't have the facility
> to say "any time you're not in one of these N functions, there should be the
> following relationship between these collection of values:..."
"In computer science, a predicate is called an invariant to a sequence
of operations provided that: if the predicate is true before starting
the sequence, then it is true at the end of the sequence."
"Programmers often make use of assertions in their code to make invariants
explicit."
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |