Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@DrEmann I'm not familiar with C# (Java instead and come C) but I think it would be better to just throw and EOFException and allow checking with something like stream.available() before?
-
hawkes15688y@LinusCDE you should not use exceptions for program flow - at least for "expected" cases like "end of file".
Exceptions are expensive in many languages. -
@hawkes Not really in Java. Also if you take C, there you are required to check for stream.available(). And in Java you probably will put data streaming always in a try-catch because of e.g. IOException which is thrown if the connecting wasn't successful.
-
-
DrEmann2538yLike parsing an integer. C# gets it right there, at least, thanks to out parameter support.
Related Rants
Got to admit. Got a little surprised when stream.ReadByte() returned an integer instead of a byte.
undefined
c#