aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-projects/plugins/project/src/cpp/main.c
blob: 05a68cccd306decbc343ca068c226b7e3c7fbdf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h> /* NOK, according to the MISRA C 2004 20.9 rule, stdio.h must not be used in embedded system's production code */

#include <mylib.h>

/*
 * Compile & run from current folder:
 *   gcc -Wall -pedantic -std=c99 -I../lib -o main main.c && ./main
 */
 
int main(void) {
  int x = ADD(40, 2);
  
  if (x != 42)
  { /* NOK, empty code blocks generate violations */
  }

  printf("40 + 2 = %d\n", x);
}