Shouldn't this code generate C4473

James Bloom-Scheff 1 Reputation point

This line of code isn't generating any errors:

sprintf(szErrFmtStr, "Failed to connect to %s");

shouldn't this generate C4473 - not enough arguments passed for format string

Or am I missing something? The code compiles without warnings, but gives an access violation when executed. It doesn't look like the warning is disabled.

I'm compiling with VS2019, warning level set to 4.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,440 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,447 questions
{count} votes

1 answer

Sort by: Most helpful
  1. James Bloom-Scheff 1 Reputation point

    Well, I found this

    define sprintf libintl_sprintf

    so its not sprintf being called but libintl_sprintf. I imagine that means the compile doesn't know to check the arguments.

    That was it

    0 comments No comments