On Tuesday 24 April 2001 17:14, Boget, Chris wrote:
> > > > > > if (@foo_bar (42, 4711) == ERROR_CODE) {
> > > > > >    PrintXMLErrorMessage ();
> >
> > Well, we both are right. The snippet I suggested (top of this mail)
> > *will* work, because the @ operator doesn't mess with the return
> > value of  the function.
>
> That is correct.  However, the "== ERROR_CODE" suggests that
> an error code will be returned by foo_bar().  However, that code
> will be suppressed by the "@" symbol and that is what I was commenting
> on... the fact that the above example couldn't be used if you wanted
> to print your own error messsage.

Functions return some value. Depending on the function, some ranges of 
returned values are interpreted as error code (e.g. 0 for mysql_connect). 
That is *not* in any way suppressed by @.

> > But I never suggested using set_error_handler() :)
>
> But the issue at hand was the fact that the original poster
> was using, and needed to use, set_error_handler to handle
> their own errors.

Well, "needed to use" might be incorrect, because return value evaluation 
can be used instead (unless some functions never signal errors via their 
return value). Aside from that you're right.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I sat laughing snidely into my notebook until they showed me a PC running
Linux. And oh! It was as though the heavens opened and God handed down a
client-side OS so beautiful, so graceful, and so elegant that a million
Microsoft developers couldn't have invented it even if they had a hundred
years and a thousand crates of Jolt cola.

- LAN Times

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to