On 2/9/10 12:33 AM, Iñaki Baz Castillo wrote:
El Martes, 9 de Febrero de 2010, Daniel-Constantin Mierla escribió:
So what about if I want to develop a module function which can return 0 as a valid integer
You can do that ...
and store it in a pv?
but it won't get here!
Sure, I've experimented by myself :)
Returning 0 from a function (core or module) is 'exit' from the beginning of SER in 2001, it is how tm functions absorb retransmissions and the config is not executed further (e.g., t_check_trans(), t_newtran(), ...).
Oh yes, it makes more sense now :)
"return 0" is document (AFAIK) but I didn't expect that any function returning 0 means "exiting".
It means. 'return' is a core function.
But I don't meant "return" core function, but any other function. Anyhow understood now.
returning 0 from any config function to stop the execution was actually there before 'exit'. Now 'exit' (and 'drop') is associated with an internal flag in the execution state. But I believe changing 'return 0' will create some confusion. I would prefer a clean similar-to-C approach and internal flags usages for special cases, but we have to leave with the history sometimes ... Could be a debate for future major releases and will imply quite some work.
Cheers, Daniel