fix(build): Address various compiler warnings (ULL, const-correctness, Wformat)#1530
Closed
jesper-olsen wants to merge 1 commit intoTheAlgorithms:masterfrom
Closed
fix(build): Address various compiler warnings (ULL, const-correctness, Wformat)#1530jesper-olsen wants to merge 1 commit intoTheAlgorithms:masterfrom
jesper-olsen wants to merge 1 commit intoTheAlgorithms:masterfrom
Conversation
Contributor
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Contributor
|
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Change
Summary
This Pull Request addresses several compiler warnings found when compiling the repository with strict compiler flags (e.g., Clang 17.0.0 on macOS, which uses -Wall). These changes ensure better code quality, portability, and adherence to modern C standards without altering the functionality of the algorithms.
Specific Warnings Fixed
-Wimplicitly-unsigned-literal):ULLsuffix to large constants indecimal_to_any_base.candhash_djb2.c.-Wabsolute-value):fabsfto the double-precision functionfabsingeometry/vectors_3d.cbecause the variablealphais of typedouble.-Wincompatible-pointer-types-discards-qualifiers):(const int **)in themainfunction ofmodified_binary_search.cto match the function signature, resolving the const-discarding warning.-Wformat):scanfincollatz.cto%lluto correctly read into auint64_t.printfformat specifier inshell_sort2.cfrom%.4g(double) to%.4lu(unsigned long) for printingclock_tdifferences.prime_factoriziation.c(C99 style initialization inside theforloop).Thank you for reviewing!
Checklist
Notes: