Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
langc
size_t len;
char cstr[] = "char string";
signed char scstr[] = "signed char string";
unsigned char ucstr[] = "unsigned char string";

len = strlen(cstr);
len = strlen(scstr);  /* warnsWarns when char is unsigned */
len = strlen(ucstr);  /* warnsWarns when char is signed */

Compiling at high warning levels in compliance with MSC00-C. Compile cleanly at high warning levels causes warnings to be issued when

  • converting Converting from unsigned char[] to const char * when char is signed.
  • converting Converting from signed char[] to const char * when char is defined to be unsigned.

Casts are required to eliminate these warnings, but excessive casts can make code difficult to read and hide legitimate warning messages.

...

Tool

Version

Checker

Description

Compass/ROSE

 

 

 

ECLAIR
Include Page
ECLAIR_V
ECLAIR_V

CC2.STR04

Fully implemented

EDG

 

 

 

Fortify SCA

5.0

 

Can detect violations of this rule with CERT C Rule Pack, except cases involving signed char

PRQA QA-C
Include Page
PRQA_V
PRQA_V
0432 (C)Partially implemented

...