On 12/13/11 1:25 PM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
coding wise might not be a lot, thus I
haven't analyzed all the cases
where functions are evaluated by return code, but it will impact and
break config file as it used to be so far, for example:
route[x] {
return -1;
}
if(route(x)) will be true, since if(-1) is true in C
i meant get rid of C
interpretation when if evaluates the condition,
i.e., do not covert condition to anything, but just test if condition is
< 0 for false and> 0 for true.
This is what happens actually:
if(route(x) == 1) is seen by interpreter as:
if(left_expression == 1)
then left_expression is evaluated as you say above:
- < 0 is false => this is 0 is C
- > 0 is true => this is 1 in C
Since left_expression can be complex (include sub expressions), there
has to be propagation to false/true. For example you can have in the
left expression (2<1) or variables with such values.
Anyhow, if you have some ideas, you can play with functions in lvalue.c,
rvalue.c and action.c
Cheers,
Daniel
--
Daniel-Constantin Mierla --
http://www.asipto.com
http://linkedin.com/in/miconda --
http://twitter.com/miconda