User`s guide
5 Controlling Code Generation
5-40
Including M-File Information in Compiler Output
The annotation options allow you to control the type of annotation in the
Compiler-generated C or C++ code. These options let you include the comments
and/or source code from the initial M-file(s) as well as
#line preprocessor
directives. You can also use an annotation option to generate source file and
line number information when you receive run-time error messages. To control
code annotation, use
-A <option>
You can combine annotation options, for example, selecting both comments and
#line directives. The remaining sections focus on the different choices you can
use.
Controlling Comments in Output Code
Use the annotation:type option to include your initial M-file comments and
code in your generated C or C++ output. The possible values for
type are
•
all
• comments
• none
Not specifying any annotation type uses the default of all, which includes the
complete source of the M-file (comments and code) interleaved with the
generated C/C++ source.
The following sections show segments of the generated code from this simple
Hello, World example:
function hello
% This is the hello, world function written in M code
fprintf(1,'Hello, World\n' );
Note To improve the readability of your generated code, turn off
optimizations with
-O none or -g. The examples in this section have
optimizations off.