-------------------------------------------------- --- Manual Additions/Modifications --- -------------------------------------------------- PC-lint for C/C++ Version 7.50b This read.me supplements the document entitled "Reference Manual for PC-lint", Gimpel Software, Nov. 1995 and the "Version 7.5 Addendum for PC-lint/FlexeLint C/C++", July, 1997. ------ Additional Options ------ The following options have been added. o -fai (Arguments pointed to get Initialized) (default ON) When an argument is passed to a function in the form of the address of a scalar and if the receiving parameter is not declared as const pointer, then it is assumed by default that the scalar takes on new values and that we do not know what those values are. Thus, in the following: void f( int ** ); void g() { int *p = NULL; f( &p ); *p = 0; // OK, no warning. } we do not warn of the possibility of the use of a NULL pointer because our past knowledge is wiped away by the presumed initialization afforded by the function f. However, if the flag is turned OFF (using -fai), then we will warn of the possibility of the use of a NULL pointer. o +fep (Extended Pre-processor variable) flag (default OFF) Normally, enumeration constants and const variables that serve as constants are ignored when computing #if directives. Although the standard does not allow such variables some compilers do. If this flag is ON they are permitted. Thus: //lint +fep const int N = 2; enum { M = 3 }; #if N < M /* allowed only if +fep is ON */ #endif o +ffb (for loop creates separate block) flag (default ON) The emerging C++ standard designates that variables declared within for clauses are not visible outside the scope of the for loop. For example, in the following code, i can't be used outside the for loop. for( int i = 0; i < 10; i++ ) { // ... } // can't use i here. Some compilers still adhere to an earlier version of the emerging standard in which variables so declared are placed in the nearest encompassing block. By default, this flag is ON indicating that the standard is supported. If your compiler follows a prior standard you may want to turn this OFF with the option -ffb o +dname=value An option of the form +d... behaves like -d... except that the definition is locked in and will be resistant to change even though a subsequent #define of the same name is encountered. o -maxopen(n) By default, PC-lint and FlexeLint presume they can open 12 files simultaneously. However, some operating systems/libraries do not allow 12 files open simultaneously. If, for example, your system will only allow 8 files open simultaneously you may use the -maxopen(8) option to express this fact. As long as the number given in the option is less than or equal to the actual number of allowed open files, you will be OK. If PC-lint/FlexeLint cannot open as many files as it thinks it should be able to, then, with deeply nested include sequences, a Fatal Error 322 will be issued. o #asm and #endasm Two pre-processor commands that can be activated with the +ppw option are asm and endasm. Thus +ppw(asm) will activate the #asm preprocessor command and +ppw(endasm) will activate the #endasm preprocessor command. This is intended only to support compilers which use this convention to turn on and off in-line assembly. ------ Additional Error Messages ------ 429 Custodial pointer 'Symbol' (Location) has not been freed or returned -- A pointer of auto storage class was allocated storage which was neither freed nor returned to the caller. This represents a "memory leak". A pointer is considered custodial if it uniquely points to the storage area. It is not considered custodial if it has been copied. Thus: int *p = new int[20]; // p is a custodial pointer int *q = p; // p is no longer custodial p = new int[20]; // p again becomes custodial q = p + 0; // p remains custodial Here p does not lose its custodial property by merely participating in an arithmetic operation. 664 Left side of logical OR (||) or logical AND (&&) does not return -- An exiting function was found on the left hand side of an operator implying that the right hand side would never be executed. For example: if( (exit(0),n == 0) || n > 2 ) ... Since the exit function does not return, control can never flow to the right hand operator. 677 sizeof used within preprocessor statement. -- Whereas the use of sizeof during preprocessing is supported by a number of compilers it is not a part of the ANSI C or C++ standard. 1077 Could not evaluate default template parameter 'String' -- The evaluation of template parameters is deferred until needed. Thus: template< class T = abc > class A { /* ... */ }; will be greeted with an Error 1077 only if an instantiation of A requires evaluation of the default argument and if that evaluation cannot be made. In that event int is assumed for type parameters and 0 is assumed for object parameters. 1533 Repeated friend declaration for symbol 'Symbol' -- A friend declaration for a particular symbol (class or function) was repeated in the same class. Usually this is a harmless redundancy. Gimpel Software Sept., 1997