Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mdejong
Copy link
Contributor

@mdejong mdejong commented Jul 5, 2019

…s like FileIO, the isEOF method only returns true after a read operation that returns an EOF condition

…s like FileIO, the isEOF method only returns true after a read operation that returns an EOF condition
@mdejong
Copy link
Contributor Author

mdejong commented Jul 5, 2019

Note that this is my first patch, CLA is here: FLIF-hub/FLIF-CLAs#22


bool isEOF() const {
return seek_pos >= data_array_size;
if(readEOS) {
Copy link
Contributor

@lehitoskin lehitoskin Jul 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to return readEOS;

Copy link
Contributor Author

@mdejong mdejong Jul 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the form you describe makes it more difficult to actually debug the code when a developer wants to set a breakpoint that would get hit only in the EOF returns true case. By actually writing out the if block, the code can then be debugged with a breakpoint as is.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that most debuggers like gdb let you set conditional breakpoints for this purpose.

}
bool isEOF() const {
return seek_pos >= bytes_used;
if(readEOS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be simplified (identical to line 94).

@jonsneyers jonsneyers merged commit 732849b into FLIF-hub:master Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants