Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
safety-second
· 6y ago · 0 comments
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.
Comments
[–]
quietbritishjim
6y ago
Exceptions 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.