Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#348 Review usage of fgets in file reading #398
#348 Review usage of fgets in file reading #398
Changes from 36 commits
38e6af1
19621b8
b294490
f8a986a
2d0318e
b3500cf
2e6e2f6
eddfbfd
5fe36d5
d10b061
a948f90
974d984
579e53d
7a11229
c5a5841
0ce1332
0a7ef03
8cf8548
4e58d00
9bf132c
c0d8c67
42da065
1ec81e9
cb7dce9
24b4d1a
06d6617
ae33beb
7fb00c5
bc6ca57
35947c7
717e2de
25f74ad
e7a65a4
d79be5d
c3738ac
4c45c92
5f33659
c87650d
ba4fcc4
386d7e9
667a8ff
1a67f3a
4459401
6d6c384
8ff132d
24449ac
6000ef6
b956da7
34ca3b2
681436e
d7575f9
f25766a
18b5b58
f56f09c
71f148c
0d65145
9191912
7657f96
347c23a
e2fd510
0c90128
67d076f
eb7e2ef
ca794d3
487f21e
683adb4
8b6e88c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and the other uses of
perror()
) is not too informative. If the (un)expected error occurs, you will get a message:You should consider to use
fprintf(stderr, "RuntimeError: %s:%ld", __FILE__, __LINE__)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to documentation message will be: for code example:
"RuntimeError: No such file or directory" but if fprintf is a standard I can change it. Eventually add that additional error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's new for me - thanks.
Then that would be fine for me.
I don't believe there is a "standard" way. In the (Tlf's) code above you check the result of memory allocation. Theoretically you will get an error message something like "Not enough memory" - without any context (eg. in which file and which function triggered the error). This is why I prefer the
fprintf()
with that way, but I do not consider it as "standard".As I wrote, this would be fine for me. (With one note: this string is enough for argument: "RuntimeError" - no need the
:
and extra space)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nicer to check the pointer itself, as you do it here:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh my mistake, vscode automatically suggested that variable. Fixed in in comming commit