TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  CFL#003Checked automatically with code checker

This rule is Obsolete
Synopsis:An else sub-statement of an if statement shall not be an if statement without an else part
Language:C++
Severity Level:5
Category:Control Flow


Description:

This means that the final 'else if' shall be followed by an 'else', in the same way as the final case label in a switch statement shall be followed by a default label in [CFL#002].

Example:

if ((c == c0) || (c == c1))
{
	x;
}
else if (c == c2)
{
	y;
}
else			// 'else' required after final 'else if', even if empty
{
	z;		// possibly an assertion that this should not be reached
}