4 ms·
You could use a File class that throws on EOF, but that would be a really bad idea for C++ since throw/catch are very expensive.
by safety-second 7y ago
You could use a File class that throws on EOF, but that would be a really bad idea for C++ since throw/catch are very expensive.
- quietbritishjim 7y agoExceptions are expensive compared to a simple function call, but I imagine they're cheap compared to operations that read from disk. Certainly one exception per file close is not going to hurt.