Skip to content

[Question] many conversion warnings at compilation time #1004

@enricovittorini

Description

@enricovittorini

would like to understand why the minimal example report so many warning:

crow version: v1.2.1.2


\crow\mustache.h(116,48): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
\crow\mustache.h(97,33): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
\crow\json.h(1747,32): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
\crow\json.h(1265,35): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data
\crow\http_parser_merged.h(607,32): warning C4244: '=': conversion from '__int64' to 'unsigned long', possible loss of data
\crow\http_parser_merged.h(587,32): warning C4244: '=': conversion from '__int64' to 'unsigned long', possible loss of data


#ifdef _WIN64
#define _WIN32_WINNT 0x0A00  // Windows 10
#endif  // End of _WIN64 check

#include "crow.h"

void main() {

    crow::SimpleApp app; //define your crow application

    //define your endpoint at the root directory
    CROW_ROUTE(app, "/")([]() {
        return "Hello world";
        });

    //set the port, set the app to run on multiple threads, and run the app
    app.port(18080).multithreaded().run();
}

Activity

added
questionIssue can be closed by providing information
on Feb 27, 2025
gittiver

gittiver commented on Feb 27, 2025

@gittiver
Member

Because we enabled this warnings some time ago for all systems and nobody was fixing them up to now.
It is easy to introduce new bugs by fixing them in my experience.

There is a draft for a pull request to fix them: #870
Hadn't the time to come back to the problem.

bcncpp

bcncpp commented on Feb 27, 2025

@bcncpp

The pr looks good do you have tests? The only concern can be multiplatfrom compatibilty.

gittiver

gittiver commented on Feb 27, 2025

@gittiver
Member

i used the existing tests, the ci builds and test on ubuntu, windows and macOS.

changed the title [-][Question] many convesion warning at compilation time[/-] [+][Question] many conversion warnings at compilation time[/+] on Feb 27, 2025
linked a pull request that will close this issueCompiler warning fixes #870on Feb 27, 2025
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

    questionIssue can be closed by providing information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @gittiver@enricovittorini@bcncpp

      Issue actions

        [Question] many conversion warnings at compilation time · Issue #1004 · CrowCpp/Crow