Re:Current hardware trends make C++ exceptions harder to jus...
by foldr on Tuesday February 22, 2022 @04:20PM
(#30433979)
This would mean that attempting to open a file that doesn't exist shouldn't throw an exception. But that is exactly what it does in the standard libraries of many languages with exceptions.
[ Parent
| on HN ]
Re:Current hardware trends make C++ exceptions harder to jus...
by spc476 on Tuesday February 22, 2022 @05:53PM
(#30435033)
It should be up to the application to throw or not, not a library. I write a system service. If it can't find the configuration file, it can't continue, so it throws an exception. If it can't open a file that contains state from a previous run (maybe because it's the first time it's running) that's fine, the program can run without it and thus, no exception.
Re:Current hardware trends make C++ exceptions harder to jus...
by jcelerier on Tuesday February 22, 2022 @04:42PM
(#30434290)
Not in C++ I believe ?
Re:Current hardware trends make C++ exceptions harder to jus...
by TheMonarchist on Tuesday February 22, 2022 @06:23PM
(#30435303)
Re:Current hardware trends make C++ exceptions harder to jus...
by YATA0 on Friday February 25, 2022 @01:49AM
(#30464346)
That is manually throwing an exception if the file doesn't exist.
C++ stdlib does not throw an exception if a file does not exist. I agree with this philosophy because files not existing isn't an exceptional case.
Re:Current hardware trends make C++ exceptions harder to jus...
by jcelerier on Wednesday February 23, 2022 @03:04AM
(#30438789)
Damn, in all those years I've absolutely never come across this, thanks