User`s guide

New Features
5-5
Code Readability Improvements
Improvements to the readability of generated code include:
Elimination of redundant parentheses.
Long C statements in the generated code are now split across multiple lines.
Block comments are more informative.
Control Flow Blocks Support
Simulink 4.1 implements a number of blocks that support logic constructs such
as if-else and switch, and looping constructs such as do-while, for, and while.
The Real-Time Workshop 4.1 supports code generation from these blocks.
For further information on the flow control blocks, see “Control Flow
Statements” in Using Simulink.
Expression Folding
Expression folding is a code optimization technique that minimizes the
computation of intermediate results at block outputs, and the storage of such
results in temporary buffers or variables. Wherever possible, the Real-Time
Workshop collapses, or “folds,” block computations into single expressions,
instead of generating separate code statements and storage declarations for
each block in the model.
Expression folding dramatically improves the efficiency of generated code,
frequently achieving results that compare favorably to hand-optimized code. In
many cases, model computations fold into a single highly optimized line of code.
Most Simulink blocks support expression folding.
For further information, see “Expression Folding” in the Real-Time Workshop
User’s Guide.