Click on image to see enlargment

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

            bug1402.cpp

1    #include <stdio.h>
2    class NorthPole
3        { public:
4        int Elves; double Toys; double Children; int Reindeer;
5        static const int toysPerElf = 10000;
6        static const int toysPerReindeer = 15000;
7        NorthPole( double children )
8            {
9            Toys = Children * 2;
10           Elves = (int) (Toys / toysPerElf);
11           Reindeer = (int) (Toys / toysPerReindeer);
12           Children = children;
13           }
14       };
15   int main()
16       {
17       NorthPole np( 3e9 );
18       printf( "Elves = %d, Toys = %g, Reindeer = %d\n",
19                np.Elves, np.Toys, np.Reindeer );
20       return 0;
21       }

Santa is gearing up for this year's Christmas production. But his new program is showing unusually small values. What's going wrong?


bug1402.cpp lint Output

--- Module:   bug1402.cpp (C++)
                           _
        Toys = Children * 2;
bug1402.cpp(9) : Warning 1402: member 'NorthPole::Children' (line 4) not initialized
    _
    };
bug1402.cpp(14) : Info 1712: default constructor not defined for class 'NorthPole'

Reference Manual Explanation


1402   member 'Symbol' (Location) not initialized -- The indicated member symbol
       was not initialized prior to use.  Either this is in a constructor where
       it is presumed that no members are pre-initialized or this is after a
       statement which will remove its initialization such as a delete or a free.


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


Previous Bug - Bug #1772 - November 2007

[ new ] 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 2007, Gimpel Software, All rights reserved.