![]() |
![]() |
2208 | ![]() |
||||
![]() | |||||||
| Bracing and Indentation | |||||||
The use of braces does not conform with "indented" style - the style currently configured in QA·C. QA·C recognises 3 alternative styles in which braces are conventionally used:
/*PRQA S 2017,3120,3197,3198,3199,3227,3408 ++*/
/*************************
* OPTIONS:
* 1. -style k+r
* 2. -style indented
* 3. -style exdented
*************************/
/**********************************/
/* 1. * 2. * 3. */
/* k+r * indented * exdented */
/**********************************/
extern int kandr(int n) {
int r = 0;
if (n > 10) { /* * 2208 * 2209 */
r = 100;
}
switch (n) { /* * 2208 * 2209 */
case 0:
r = 2;
break;
case 1:
r = 4;
break;
default:
r = 6;
break;
}
return r;
}
extern int indented(int n)
{
int r = 0;
if (n > 10)
{ /* 2207 * * 2209 */
r = 100;
}
switch (n)
{ /* 2207 * * 2209 */
case 0:
r = 2;
break;
case 1:
r = 4;
break;
default:
r = 6;
break;
}
return r;
}
extern int exdented(int n)
{
int r;
if (n > 10)
{ /* 2207 * 2208 * */
r = 100;
}
switch (n)
{ /* 2207 * 2208 * */
case 0:
r = 2;
break;
case 1:
r = 4;
break;
default:
r = 6;
break;
}
return r;
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |