On 10/15/10 12:44 PM, Juha Heinanen wrote:
Andrei Pelinescu-Onciul writes:
Because "==" works only with arguments of the same type, 0 it's autoconverted to "0". The alternative would be to log an error.
andrei,
please log an error, because it is hard to remember this uncommon comparison rule and seeing an error message would reveal the problem fast.
Not sure this is a good idea. This kind of comparison behaves the same from many versions ago.
Note that all pseudo-variables from kamailio keep all the time the string representation of the value, that was from day one, back in era of ser 0.9.x where the PV code was part of xlog module.
I don't think a strict type checking is suitable for configuration file - e.g., if I want to check value in cseq, don't want to get lost in type conversions.
If there is going to be such error messages, they must be enclosed in a config parameter.
Cheers, Daniel
Here are the rules for ==: /* if left is string, eval left& right as string and use string diff.
- if left is int eval as int using int diff
- if left is undef, look at right and convert to right type
*/
getting back to the example code, how can i check if value of a var is int 0? is there an is_int function?
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users