Main Content

Generate Code That Matches Appearance of External Code

A key aspect of code integration, especially for larger projects, is adherence to guidelines and standards for code appearance. If code appearance requirements apply to your project, review the requirements in this table. To learn more, see the relevant information.

RequirementMore Information
Thoroughly document code or document code in a specific way.
Control the length and naming of code identifiers (symbols), including the use of reserved names.

Control style aspects of code:

  • Level of parenthesization

  • Order of operations in expressions

  • Empty primary condition expressions in if statements

  • if-elseif-else or switch-case statements for decision logic

  • Use of extern keyword in function declarations

  • Use of static keyword in function declarations

  • Use of default cases for switch-case statements

  • Use multiplications by powers of two or signed bitwise shifts

  • Cast expressions

  • Indent style (Kernighan and Ritchie or Allman) and size

  • Newline style

Model Configuration Parameters: Code Style (Embedded Coder)

Placement of data definitions and declarations, including location of global identifiers and global data declarations (extern)

Control Placement of Global Data Definitions and Declarations in Generated Files (Embedded Coder)

Appearance of code for flow chartsEnhance Readability of Code for Flow Charts (Embedded Coder)
Apply code templates to control organization of code and use of banners

Related Topics