Click on image to see enlargment

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

            bug1717.cpp

1    #include <stdio.h>
2    typedef double D;
3    class Action_Figure
4        {
5        D x;
6      public:
7        Action_Figure( D a, D b ) { x = a * b; }
8        Action_Figure( D a ) { x = a; }
9        Action_Figure() { x = 5.0; }
10       void operator()()
11         { printf("Action Level at %g\n", x); }
12       };
13   int main()
14       {
15       Action_Figure plane_man( 2.2, 8.6 );
16       Action_Figure train_man();
17       Action_Figure truck_man( 3.3 );
18       plane_man();
19       train_man();
20       truck_man();
21       return 0;
22       }

Little Johnny is having some difficulties emulating the properties of his favorite action figures. The program compiles but the linker is giving him grief. What's the problem?


bug1717.cpp lint Output

--- Module:   bug1717.cpp (C++)
                             _
    Action_Figure train_man();
bug1717.cpp(16) : Info 1717: empty prototype for function declaration, assumed '(void)'
               _
    train_man();
bug1717.cpp(19) : Warning 534: Ignoring return value of function 'train_man(void)'
    (compare with line 16)

Reference Manual Explanation


1717   empty prototype for function declaration, assumed '(void)'  -- An empty
       prototype, as in:

               void  f();

       has a different meaning in C than in C++.  In C it says nothing about the
       arguments of the function; in C++, it says there are no arguments.  This
       message is not given for member function declarations or for function
       definitions. Rather, weaker Elective Notes (1917 and 1918) are given.
       This is because the chance of ambiguity does not exist in these cases.


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


Previous Bug - Bug #527 - August 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.