Opening some legacy code in Notepad++ and notice a few occurrences of FF character below function comment headers. They are ASCII code 12 which is the Form Feed character. Are FF characters valid in MISRA C2 standard please? Apologies I don't have access to PC-Lint/QAC checker.
-
A form-feed is explicitly allowed as separating white space in the C89/99/11 standard. (Section 6.4.3, "Preprocessing tokens can be separated by white space; this consists of comments (described later), or white-space characters (space, horizontal tab, new-line, vertical tab, and form-feed), or both." (You can ignore the "preprocessing token" part here.) I'm not familiar with MISRA, though I wouldn't be surprised if it doesn't talk about it. – Ulfalizer Apr 28 '15 at 08:56
2 Answers
You appear to be talking about a commercial product, whose announcements give no useful information, e.g., this press release.
Form feed is stated explicitly to be part of the character set in ISO/IEC 9899:199 (E) 5.2.1 Character sets. If the tool advised you not to use a documented, standard feature, that would be a defect in the tool itself. A comparable issue would be whether to allow tab characters in leading whitespace on a line.
Given that context, the use of form feed characters is a stylistic issue unrelated to static analysis, and I would not expect the two to be confused in a commercial product.

- 51,086
- 7
- 70
- 105
MISRA-C:2004 3.2 merely states that the character set and the corresponding encoding should be documented (for example by a reference to the relevant ISO standard). You are only allowed to use character constants and string literals that exist in that standard.
But there is no such requirement on source code comments.

- 195,001
- 40
- 254
- 396