| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
You can control the following style aspects in generated code:
Level of parenthesization
Whether to preserve order of operands in expressions
Whether to preserve empty primary condition expressions in if statements
Whether to generate code for if-elseif-else decision logic as switch-case statements
Whether to include the extern keyword in function declarations
For example, C code contains some syntactically required parentheses, and can contain additional parentheses that change semantics by overriding default operator precedence. C code can also contain optional parentheses that have no functional significance, but serve only to increase the readability of the code. Optional C parentheses vary between two stylistic extremes:
Include the minimum parentheses required by C syntax and any precedence overrides, so that C precedence rules specify all semantics unless overridden by parentheses.
Include the maximum parentheses that can exist without duplication, so that C precedence rules become irrelevant: parentheses alone completely specify all semantics.
Understanding code with minimum parentheses can require correctly applying nonobvious precedence rules, but maximum parentheses can hinder code reading by belaboring obvious precedence rules. Various parenthesization standards exist that specify one or the other extreme, or define an intermediate style that can be useful to human code readers.
You control the code style options by setting parameters on the Real-Time Workshop > Code Style pane. For details on the parameters, see Real-Time Workshop Pane: Code Style in the Real-Time Workshop Embedded Coder reference documentation.
![]() | Configuring the Appearance of Generated Identifiers | Configuring Templates for Customizing Code Organization and Format | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |