Main Content

Number of Executable Lines

Number of executable lines in function body

Description

Note

Use Bug Finder instead of Code Prover for computing code metrics. Support for computing code metrics in Code Prover will be removed in a future release. See Version History.

This metric measures the number of executable lines in a function body. When calculating the value of this metric, Polyspace® excludes declarations, comments, blank lines, braces or preprocessing directives.

If the function body contains a #include directive, the included file source code is also calculated as part of this metric.

This metric is not calculated for C++ function templates and lambdas. For these entities, the value is reported as Not computed.

Examples

expand all

void func(int, double);

	int getSign(int arg) {//Excluded
	int sign; //Excluded
	static int siNumber = 0; //Excluded
	double dNumber = 5;//Excluded
	if(arg<0) {
		sign=-1;
		func(-arg,dNumber);
		++siNumber;
		/* func takes positive first argument */   //Excluded
	}//Excluded
	else if(arg==0)
	sign=0;
	else {
		sign=1;
		func(arg,dNumber);
		++siNumber;
	}//Excluded
	return sign;
}//Excluded

In this example, the number of executable lines of getSign is 11. The calculation excludes:

  • The definition of the function.

  • The variable declarations.

  • The comment /* ... */.

  • The lines with braces only.

Metric Information

Group: Function
Acronym: FXLN
HIS Metric: No

Version History

expand all