Compartir a través de


PREfast Warning 272 (Windows CE 5.0)

Send Feedback

272 - Format string mismatch.
Additional Information: Non-float passed as argument <number> when float is required in call to <function>.

This warning indicates that the format string specifies that a float is required (for example, a %f or %g specification for printf) but a nonfloat such as an integer or string is being passed.

This defect can result in incorrect output; however, in certain circumstances, it can result in a crash.

This warning is often reported because of subtle errors in format strings, such as extra embedded spaces or unescaped percent signs.

If the warning appears to be incorrect, double-check your format string.

PREfast interprets format strings based on the implementations in the C run-time library that is included with Visual C++ .NET 2002.

Example

Defective Source

char buff[5];

sprintf(buff,
        "%s %f",
        "a",
        i);

Corrected Source

char buff[5];

sprintf(buff,
        "%s %i",
        "a",
        i);

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.