Main Content

Indent style

Description

Specify style for the placement of braces in generated code.

Category: Code Generation > Code Style

Settings

Default: K&R

K&R

For blocks within a function, an opening brace is on the same line as its control statement. For example:

void rt_OneStep(void)
{
  static boolean_T OverrunFlag = 0;
  if (OverrunFlag) {
    rtmSetErrorStatus(rtwdemo_counter_M, "Overrun");
    return;
  }

  OverrunFlag = TRUE;
  rtwdemo_counter_step();
  OverrunFlag = FALSE;
}
Allman

For blocks within a function, an opening brace is on its own line at the same level of indentation as its control statement. For example:

void rt_OneStep(void)
{
  static boolean_T OverrunFlag = 0;
  if (OverrunFlag)
  {
    rtmSetErrorStatus(rtwdemo_counter_M, "Overrun");
    return;
  }

  OverrunFlag = TRUE;
  rtwdemo_counter_step();
  OverrunFlag = FALSE;
}

Command-Line Information

Parameter: IndentStyle
Type: character vector
Value: 'K&R' |'Allman'
Default: 'K&R'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Related Topics