Skip to content

process the scanf() output so Ubuntu 22 compiler doesn't error due to… #3

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

Merged
merged 1 commit into from
Mar 17, 2023
Merged

Conversation

bigattichouse
Copy link

… default warn_unused_result instead of Makefile -Wunused-result

Ubuntu 22.04.2 LTS gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) errors during compilation because of an unused result. fixed (checks for value, but ignores which the parent check ALSO does).

… default warn_unused_result instead of Makefile -Wunused-result
@anzz1
Copy link

anzz1 commented Mar 16, 2023

Why not Makefile -Wunused-result ? Seems cleaner than adding code with no functionality.

@bigattichouse
Copy link
Author

bigattichouse commented Mar 16, 2023

Ultimately, the code could be changed to replace the behavior universally with error messages... a change in the makefile is just ignoring the problem. -Wunused-result can have a lot of knock on effects for code quality later for other functions. Why put the future code at risk for one line.

@anzz1
Copy link

anzz1 commented Mar 16, 2023

I've always considered the 'unused-result' to be a non-warning, a nag. There are a lot of valid cases where you need to use a function but don't care about its' return value and making non-functional if-statements instead of just disabling the nag seems to me to do exactly the thing you're trying to avoid, worsen code quality.

@bigattichouse
Copy link
Author

bigattichouse commented Mar 16, 2023

I suppose that's fair, but in this case the parent function checks the value, then looks for this empty line. I think having this one case just for the sake of consistency would make later refactoring better - repeat the pattern.

While I guess I'd be included to agree with you, I tend to avoid modifying the compiler flags which feels a bit like turning up the radio so you can't hear your brakes squealing.

It's odd that that line is in there anyway, I wonder if it's a hack to just get it to work. Perhaps deeper testing is in order to find out why it's there.

@antimatter15 antimatter15 merged commit 2af2331 into antimatter15:master Mar 17, 2023
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.

3 participants