Skip to content

-Wsign-conversion #18

Description

@oschonrock
/home/oliver/c/qa/include/sha1/sha1.hpp:240:20: warning: implicit conversion changes
      signedness: 'int' to 'uint32_t' (aka 'unsigned int') [-Wsign-conversion]
                   | (buffer[4*i+0] & 0xff)<<24;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/oliver/c/qa/include/sha1/sha1.hpp:263:35: warning: implicit conversion changes
      signedness: 'unsigned long' to 'std::streamsize' (aka 'long') [-Wsign-conversion]
        is.read(sbuf, BLOCK_BYTES - buffer.size());
           ~~~~       ~~~~~~~~~~~~^~~~~~~~~~~~~~~

Activity

  1. vog commented on Oct 4, 2021

    @vog
    Owner

    Please provide some context to your report. Which OS, architecture and compiler version do you use?

  2. oschonrock commented on Oct 4, 2021

    @oschonrock
    Author

    Sorry. Here you go:

    OS: ubuntu 20.04 - arch x86_64
    compiler: clang-12

    compile command:

    clang++  -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Wextra-semi -Wshadow-field-in-constructor -Wmissing-noreturn -Wunreachable-code-break -std=c++2a
    

    I believe it is the -Wconversion which is throwing this warning.

  3. matu3ba commented on Nov 27, 2024

    @matu3ba

    here are my fixes with -Weverything for a job interview task
    https://gist.github.com/matu3ba/930715a9cb1e361ed8e03118a60970e4

    Compile with .hpp included with

    clang++ -std=c++20 -Werror -Weverything  -ferror-limit=100 -Wno-c++98-compat-pedantic -Wno-unsafe-buffer-usage -Wno-switch-default ./example.cpp -o example.exe
    zig c++ --target=x86_64-windows -std=c++20 -Werror -Weverything  -ferror-limit=100 -Wno-c++98-compat-pedantic -Wno-unsafe-buffer-usage -Wno-switch-default ./example.cpp -o example/.exe
    

    clang version 18.1.8
    zig version 0.14.0-dev.6403+e2f24a2d7

  4. vog commented on Nov 28, 2024

    @vog
    Owner

    @matu3ba This is great! Would you mind creating a pull request?

  5. matu3ba commented on Dec 6, 2024

    @matu3ba

    see #19

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions