Monday 28 September 2009

How many bugs in blank lines

Did you know that a blank line can cause syntax errors?

The number of blank lines that I have been responsible for maintaining is an estimate based on
summary figures for projects I have worked on since the mid 90's

In 4 projects, written in C, the total lines of code and total blank lines are:

Project,Total lines,Blank lines,Comments
A,391343,40415
B,735210,72433
C,306296,41813
D,1638651,271658

An example of a blank line causing a syntax error is:

void main( void )
{
#define blankmac \
int a = 1 \

;
blankmac
}

So you can imagine how many potential bugs there are in these projects given that on average there's one every 1,000 lines!

No comments:

Post a Comment