sqc 0.4.13

Software Code Quality - CERT C compliance checker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * Rule: INT15-C
 * Source: wiki
 * Status: PASS - Should NOT trigger INT15-C violation
 * Description: Using uintmax_t for formatted I/O on programmer-defined types
 */

#include <stdio.h>
#include <inttypes.h>

typedef unsigned long long mytypedef_t;

void compliant(void) {
    mytypedef_t x = 42;
    /* Compliant: casting to uintmax_t with %ju format */
    printf("%ju", (uintmax_t) x);
}