Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(build): Address various compiler warnings (ULL, const-correctness, Wformat)#1530

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jesper-olsen wants to merge1 commit intoTheAlgorithms:master
base:master
Choose a base branch
Loading
fromjesper-olsen:fix/compiler-warnings

Conversation

@jesper-olsen
Copy link

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

  1. Implicit Unsigned Literals (-Wimplicitly-unsigned-literal):
    • Fixed by adding theULL suffix to large constants indecimal_to_any_base.c andhash_djb2.c.
  2. Double/Float Mismatch (-Wabsolute-value):
    • Changedfabsf to the double-precision functionfabs ingeometry/vectors_3d.c because the variablealpha is of typedouble.
  3. Const-Correctness (-Wincompatible-pointer-types-discards-qualifiers):
    • Applied an explicit cast(const int **) in themain function ofmodified_binary_search.c to match the function signature, resolving the const-discarding warning.
  4. Format Mismatch (-Wformat):
    • Corrected the format specifier forscanf incollatz.c to%llu to correctly read into auint64_t.
    • Corrected theprintf format specifier inshell_sort2.c from%.4g (double) to%.4lu (unsigned long) for printingclock_t differences.
  5. Misc:
    • Simplified array iteration initialization inprime_factoriziation.c (C99 style initialization inside thefor loop).

Thank you for reviewing!

Checklist

  • Added description of change
  • PR title follows semanticcommit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@Panquesito7Panquesito7Awaiting requested review from Panquesito7Panquesito7 is a code owner

@tjgurwara99tjgurwara99Awaiting requested review from tjgurwara99tjgurwara99 is a code owner

@alexpantyukhinalexpantyukhinAwaiting requested review from alexpantyukhinalexpantyukhin is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@jesper-olsen

[8]ページ先頭

©2009-2025 Movatter.jp