@smititelu, @pkuzak - it is a misunderstanding of what $var() is supposed to do and how it acts. It is not only about an extra int field, it is about the concept behind $var().

What @smititelu gave as an example is what the note in docs try to say and what I gave as an example above.

It can create big problems no matter is with the warning or not in the C code, because it still keeps the value from previous assignment.

Let's say you have this situation:

Coming back to @smititelu example, you have to set var to a value that you can compare with, like:

$var(data)="";
if (is_present_hf("SOME_HEADER")) {
    $var(data) = _get_data_from_some_header_;
}
if ($var(data) != "") {
    _do_something_with_data_
}

Which is same concept as with my while example above.

Or use $x/avp() without setting a value and compare with $null.

As I said, I don't see any benefit with the PR, irrelevant of being optional or not.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/3114/c1128906490@github.com>