Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Correcting format specifiers

...

Code Block
bgColor#FFcccc
langc
#include <stddef.h>
#include <stdio.h>
  
void f(size_t n) {
  /* n must be incremented */ 
  size_t a = sizeof(int[++n]);
 
  /* n need not be incremented */
  size_t b = sizeof(int[++n % 1 + 1]);

  printf("%z%zu, %z%zu, %z%zu\n", a, b, n);
  /* ... */
}

...

Code Block
bgColor#ccccFF
langc
#include <stddef.h>
#include <stdio.h>
  
void f(size_t n) {
  size_t a = sizeof(int[n + 1]);
  ++n;

  size_t b = sizeof(int[n % 1 + 1]);
  ++n;
  printf("%z%zu, %z%zu, %z%zu\n", a, b, n);
  /* ... */
}

...

Tool

Version

Checker

Description

Clang
Include Page
Clang_V
Clang_V
-Wunevaluated-expression 

Compass/ROSE

 

 

 

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

CC2.EXP06

Fully implemented

LDRA tool suite

Include Page
LDRA_V
LDRA_V

54 S, 653 S

Fully implemented

Parasoft C/C++test9.5JSF-166{b,c}Fully implemented
PRQA QA-C
Include Page
PRQA QA-C_v
PRQA QA-C_v
3307Fully implemented
Clang
Include Page
Clang_V
Clang_V
-Wunevaluated-expression 

...