Click on image to see enlargment

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

            bug1770.cpp

---------------- Module bug1770a.cpp ------------

1    int main()
2        {
3        for( int i = 0; i < 100000; i++ )
4            {
5            int *p = new int;
6            *p = i;
7            delete p;
8            }
9        return 0;
10       }

---------------- Module bug1770b.cpp ------------

1    void * operator new( unsigned size )
2        {
3        static unsigned char a[10000];
4        static unsigned used = 0;
5
6        used += size;
7        if( used > 10000 ) return 0;
8        return &a[used-size];
9        }

This two module program, simplified from the original, keeps crashing. What's the problem?


bug1770.cpp lint Output

--- Module:   bug1770a.cpp

--- Module:   bug1770b.cpp
    _
    {
bug1770b.cpp  2  Info 1771: function 'operator new(unsigned int)' replaces
    global function

--- Global Wrap-up

Info 1770: function 'operator new(unsigned int)' defined without function
    'operator delete' 

Reference Manual Explanation


1770  function 'Symbol' defined without function 'String'  -- A typical
      Info 1770 message is:

          function 'operator new(unsigned)' defined without function
          'operator delete'

      There are three others:

           operator delete without an operator new,
           operator new[] without an operator delete[], and
           operator delete[] without an operator new[].

      In general it is not a good idea to create one of these functions without
      the other in the pairing.   [23, Item 27]

      You can suppress any of these without suppressing them all.  Simply do
      a -esym(1770,name) where name is the first function named in the message.

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

Previous Bug - Bug #1763 - January 2005

PC-lint/FlexeLint - Product Overview

Home | Contact | Order

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