> Looking at assembly listings of the Linux kernel I see thousands of > places where function returns are checked to be non-zero to indicate > errors. For example something like this: > > mov bx, 0 > .L1 > call foo > test ax,ax > jnz .Lerror
Another calling convention could be to not only return the "return value" in %eax (or %edx:%eax for long long returns) but also its comparisson to zero in the flags, so that you get: call foo jg .Lwarning jnz .Lerror The test is done in the called function, but it is often do there anyway, for instance when another internal function failed there is a chain of return and the same %eax value is tested over and over again, in each function body, followed by a return. Etienne. ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com