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.
C++ exceptions are only good if you use them like signals from C or panics in Go. This means you have to use error values for 99% of errors or you lose this benefit. The fact that the STL sprinkles exceptions everywhere…
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.
C++ exceptions are only good if you use them like signals from C or panics in Go. This means you have to use error values for 99% of errors or you lose this benefit. The fact that the STL sprinkles exceptions everywhere…