Click on image to see enlargment

PC-lint/FlexeLint Output | Reference Manual Explanation | Home

            bug620.c

1    #include <math.h>
2    #include <stdio.h>
3    void blanks(int n)
4        {
5        for( int i = 0; i < n; i++ )
6            printf( " " );
7        }
8    void v(int age)
9        {
10       int ht = (age + 1) / 2;
11       int odd = age % 2;
12       for( int i = 1; i <= ht; i++ )
13           {
14           blanks( i );
15           printf( "*" );
16           blanks( 2 * (ht - i) - odd );
17           if( i != ht || !odd )
18               printf( "*" );
19           printf( "\n" );
20           }
21       }
22   int main() { v( 2l ); return 0; }

For Virginia's 21st birthday, Mike produced this program that would produce a large V to be used as a template for an accurate set of birthday candles. But something's wrong. He's not getting enough candles. Hint: you may need the visual acuity of a hawk to find the problem.


bug620.c lint Output

--- Module:   bug620.c (C)
                _
int main() { v( 2l ); return 0; }
bug620.c  22  Warning 620: Suspicious constant (L or one?)

Reference Manual Explanation


620    Suspicious constant (L or one?)  -- A constant ended in a lower-case letter 'l'.
       Was this intended to be a one?  The two characters look very similar.  To avoid
       misinterpretations, use the upper-case letter 'L'.


If you have comments or questions about this bug, please post them to our   Discussion Forum


Previous Bug - Bug #18 - June 2010

Use our Interactive Demo to Run FlexeLint on our Bugs of the Month

PC-lint/FlexeLint - Product Overview

Home | Contact | Order

PC-lint and FlexeLint are trademarks of Gimpel Software
Copyright 2010, Gimpel Software, All rights reserved.