Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2004-14.5

In this section:
Synopsis

(Required) The continue statement shall not be used.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Uses of the continue statement were found.

Coding standards
MISRA C:2004 14.5

(Required) The continue statement shall not be used.

Code examples

The following code example fails the check and will give a warning:

#include <stdio.h>

// Print the odd numbers between 0 and 99

void example(void) {
	int i;
	for (i = 0; i < 100; i++) {
		if (i % 2 == 0) {
			continue;
		}
		printf("%d", i);
	}
}

The following code example passes the check and will not give a warning about this issue:

#include <stdio.h>

// Print the odd numbers between 0 and 99

void example(void) {
	int i;
	for (i = 0; i < 100; i++) {
		if (i % 2 != 0) {
			printf("%d", i);
		}
	}
}