Control Parentheses in Generated Code
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 only increase the readability of the code. Optional C parentheses vary between two stylistic extremes:
Include the minimum parentheses required by C syntax and 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 applying nonobvious precedence rules. 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 useful to people who read code.
Control Use of Parentheses
This example shows that Embedded Coder® provides three levels of control for parentheses in the generated code.