|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home Page bug1738.cpp
The programmer expected the first string printed to be "original" but was surprised when the second also printed "original". He expected argument passing to invoke a copy constructor that would result in a "copy". Where did the programmer go wrong? bug1738.cpp lint Output
--- Module: bug1738.cpp
_
Painting( const Painting & arg ) :Art() { name = arg.name; }
bug1738.cpp(9) : Info 1738: non copy constructor 'Art::Art(void)' used to
initialize copy constructor
bug1738.cpp(9) : Warning 1554: Direct pointer copy of member 'Painting::name'
within copy constructor: 'Painting::Painting(const Painting &)'
_
};
bug1738.cpp(12) : Info 1712: default constructor not defined for class
'Painting'
_
void print_copy( Painting arg ) { print( arg ); }
bug1738.cpp(16) : Info 1746: parameter 'arg' in function 'print_copy(Painting)'
could be made const reference
Reference Manual Explanation
1738 non-copy constructor 'Symbol' used to initialize copy constructor
-- In an initializer list for a copy constructor, a base class
constructor was invoked. However, this base class constructor was
not itself a copy constructor. We expect that copy constructors
will invoke copy constructors. Was this an oversight or was there
some good reason for choosing a different kind of constructor? If
this was deliberate, suppress this message. See also message 1538.
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #1732 - January 2003