Preserve extern
keyword in function declarations
Description
Specify whether to include the extern
keyword
in function declarations in the generated code.
Note
The extern
keyword is optional for functions
with external linkage. It is considered good programming practice
to include the extern
keyword in function declarations
for code readability.
Category: Code Generation > Code Style
Settings
Default: on
On
Include the
extern
keyword in function declarations in the generated code. For example, the generated code for the modelrtwdemo_hyperlinks
contains the following function declarations inrtwdemo_hyperlinks.h
:/* Model entry point functions */ extern void rtwdemo_hyperlinks_initialize(void); extern void rtwdemo_hyperlinks_step(void);
The
extern
keyword explicitly indicates that the function has external linkage. The function definitions in this example are in the generated filertwdemo_hyperlinks.c
.Off
Remove the
extern
keyword from function declarations in the generated code.
Command-Line Information
Parameter: PreserveExternInFcnDecls |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No impact |