Last update Jul 24, 2002
1 | function 'identifier' is too complicated to inline |
2 | possible unintended assignment |
3 | comments do not nest |
4 | assignment to 'this' is obsolete, use X::operator new/delete |
5 | no tag name for struct or enum |
6 | value of expression is not used |
7 | possible extraneous ';' |
8 | very large automatic |
9 | use delete[] rather than delete[expr], expr ignored |
10 | using operator++() (or --) instead of missing operator++(int) |
11 | non-const reference initialized to temporary |
12 | variable 'identifier' used before set |
13 | Illegal type/size of operands for the %s instruction |
14 | Reference to 'identifier' caused a 386 instruction to be generated |
15 | returning address of automatic 'identifier' |
16 | DS is not equal to DGROUP |
17 | unrecognized pragma |
18 | implied return at closing '}' does not return value |
19 | number actual arguments expected for identifier, had number |
20 | symbols or macros defined before #include of precompiled header |
21 | precompiled header must be first #include when -H is used |
22 | different configuration for precompiled header |
23 | divide by 0 |
24 | number is not representable |
25 | C style cast |
If using C++ code, look for a class with a member that is a dynamically allocated pointer to something. If you assign an instance of that class to another variable and there is no copy constructor, the compiler generates a memberwise copy, resulting in two instances containing the same pointer. Destructing both results in freeing the same point twice. For example, the following code can generate the "Heap is corrupted" message:
#include <stdlib.h> #include <string.h> struct X { char *p; X(char *s) { p = strdup(s); } ~X() { free(p); } }; void main() { X x("hello"); X y = x; // invoke copy constructor x = y; // invoke X::operator=(X&) } // Both copies are automatically // destructed at the end of the // program and cause a crash.To fix the code, add these member functions to X:
X(X& x) { p = strdup(x.p); } X& operator=(X& x) { free(p); p = strdup(x.p); return *this; }