Re: why does exit() print its argument?
| From: | Sander Steffann | Date: | Sat, 29 Sep 2001 18:53:32 +0000 |
| Subject: | Re: why does exit() print its argument? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-66833@lists.php.net to get a copy of this message | ||
Hi,
> How about if we overload it a bit. I think anybody who does exit(1) is
> expecting 1 to be set as the return status
True, exit is the 'expected' name for this behaviour IMHO.
> whereas someone who does
> exit('something bad happened') is expecting the string to be shown a-la
> die(). So let's just check the arg and do the appropriate thing. I would
> be very surprised if that broke anything.
You could do this, but I don't think it is ..realy.. needed. It would make
the function a little more complicated to understand, but it wouldn't break
backwards compatibility as much.
I am for changing exit() to do the 'expected' thing, and break a 'little'
backwards compatibility.
Usualy I am very much against breaking backwards compatibility, but in this
case I think it's the best thing to do... Because:
- It's already documented that way
- It's the 'expected' behaviour (from other languages, and from the docs)
As Rasmus said: It would be surprising if this broke a lot of (or even any)
code.
Sander.