4 ms·
"has anyone yet found a legitimate use for throwing an `int`?" I could image throwing an int when writing a shell utility and throwing the return value of main
by cjfd 5y ago
"has anyone yet found a legitimate use for throwing an `int`?"
I could image throwing an int when writing a shell utility and throwing the return value of main as an int but I suppose doing that usefully would be pretty rare. Usually one cares more about whether a shell utility is successful or not not so much about the precise reason it failed. So, while I could imagine doing that, I don't see myself going for that option too likely.
- WalterBright 5y agoYes, but you couldn't mix that code with code that throws an `int` for other porpoises. It becomes a global straightjacket for your code.
- cjfd 5y agoYes that is true. One really should not start throwing integers in code that one hopes to reuse someplace else.