Details
-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Default Severity:Minor
-
Impact:Low
-
Likelihood:Low
-
Default Quality Profiles:Sonar way, MISRA C++ 2008 recommended
-
Covered Languages:C, C++, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:15min
-
Analysis Level:Semantic Analysis
Description
The possibilities of ISO C printf format strings are limited, this is why many extensions have been added by several implementations. Even though they are widespread and similar in many implementations, they are not standard, which means that using them may create portability issues.
This rule reports an issue when format strings do not comply with ISO C standards.
Noncompliant Code Example
void test() { printf("%1$d", 1); // Noncompliant; positional arguments are not supported by ISO C printf("%qd", (long long)1); // Noncompliant; length specifier "q" is not supported by ISO C }
Attachments
Issue Links
- is implemented by
-
CPP-2145 Rule S5293: Format strings should comply with ISO standards
-
- Closed
-