[Asterisk-Dev] asterisk functions return codes
Timur V. Elzhov
Timur.Elzhov at jinr.ru
Thu Aug 4 01:14:52 MST 2005
Dear developers,
Could I clarify the convention about function return codes in the
asterisk sources? For instance, the name of `asterisk_fileexists'
function implies its use in conditions like that:
if (asterisk_fileexists(...)) - in case of existing file, and
if (!asterisk_fileexists(...)) - in case of non-existing one.
However, when file is non-existent, it returns -1, so the *first*
condition will be true, and second will be false. So the right way
I guess is to write
if (asterisk_fileexists(...) > 0)
Forgive me if I misunderstand something, but do you really find such
a behaviour convinient? I find that's not logical, if we have to call
operators like '<' or '>' when expect answer of only two values, true
and false.
So, the main question is, again: Are there a general convention about
function return codes in the asterisk sources?
Thank you.
--
Best regards,
Timur Elzhov
More information about the asterisk-dev
mailing list