【正文】
則會(huì)形成如下類型層次:If an object of type Small is assigned to a variable of type Flags1 or Flags, no strong type violatio。typedef Flags Flags2。 in context: assignment) Global Wrapup error 900: (Note Successful pletion, 6 messages produced)Tool returned code: 6parent選項(xiàng)parent( Parent, Child [, Child] ... )例:parent(Flags1,Small)strong(AJX)typedef unsigned Flags。 in context: assignment)D:\PCLint\MyTest\Test1\(18): error 633: (Warning Assignment from a strong type 39。 // Warn Flag2 = Flag1D:\PCLint\MyTest\Test1\(18): error 632: (Warning Assignment to strong type 39。Flags239。Flags139。 in context: assignment) if(f1 amp。 in context: assignment)D:\PCLint\MyTest\Test1\(14): error 633: (Warning Assignment from a strong type 39。 // WarnD:\PCLint\MyTest\Test1\(14): error 632: (Warning Assignment to strong type 39。 // OK Flag2 = Flag2 f2 = F_ONE | f1。 f2) // Warn because of J flag f2 = f2 | F_ONE。 f2 = f1。define FZERO (Flags) 0define F_ONE (Flags) 1void main(){ Flags1 f1 = FZERO。typedef Flags Flags1。Att_Char39。Col_Ix39。Row39。Row_Ix39。) scr[col][row] = BLANK。 for strong type 39。 /* Warning */D:\PCLint\MyTest\Test1\(22): error 637: (Warning Expected index type 39。 /* Warning */ scr[col][row] = BLANK。 scr[ row ][ col ] = BLANK。Col_Ix col。)Screen scr。 /* Column Index */define BLANK (Att_Char) (0x700 + 39。typedef int Row_Ix。typedef Att_Char Row[80]。sa Row is 80 Att_Char39。 i = pt t。 i++ ) t[i] = (Temperature)。 for( i = 0。 Count N = (Count)100。 Temperature *pt = t。typedef int Count。Temperature39。 in context: assignment) pt[1] = 。 // OK, i is a CountD:\PCLint\MyTest\Test1\(16): error 632: (Warning Assignment to strong type 39。Count39。 i 100。 // Warning i = pt t。 i++ ) t[i] = 。 for( i = 0。 // pointers are also checkedvoid main(){ Count i。Temperature t[100]。 in context: assignment) Global Wrapup error 900: (Note Successful pletion, 6 messages produced)Tool returned code: 6改為://lint strong( AzJX, Count, Temperature )//lint index( c, Count, Temperature )// Only Count can index a Temperatureinclude typedef float Temperature。)D:\PCLint\MyTest\Test1\(17): error 632: (Warning Assignment to strong type 39。 for strong type 39。 // WarningD:\PCLint\MyTest\Test1\(17): error 637: (Warning Expected index type 39。Temperature39。 in relational) t[i] = 。 i++ )D:\PCLint\MyTest\Test1\(15): error 638: (Warning Strong type mismatch for type 39。) for( i = 0。 for strong type 39。)D:\PCLint\MyTest\Test1\(14): error 637: (Warning Expected index type 39。 for strong type 39。 // Warnings, no c flagD:\PCLint\MyTest\Test1\(14): error 637: (Warning Expected index type 39。 // Warning i = pt t。 i++ ) t[i] = 。 // Warnings, no c flag for( i = 0。 // pointers are also checkedvoid main(){ Count i。Temperature t[100]。f:禁止1被當(dāng)成是布爾類型index指定索引類型index( flags, ixtype, sitype [, sitype] ... )flags: c allow Constants as well as ixtype, to be used as indices.(允許常量像ixtype一樣作為索引)d allow array Dimensions to be specified without using an ixtype.(允許數(shù)組維數(shù)定義時(shí)不用ixtype)例1://lint strong( AzJX, Count, Temperature )//lint index( d, Count, Temperature )// Only Count can index a Temperatureinclude typedef float Temperature。f39。BitField39。 in context: assignment) = 1。 // strong type violationD:\PCLint\MyTest\Test1\(17): error 632: (Warning Assignment to strong type 39。Bool39。 // OK}PClint for C/C++ (NT) Ver. , Copyright Gimpel Software 19852001 Module: D:\PCLint\MyTest\Test1\ = (Bool) 0。 // OK = 1。 // strong type violation = 2。 // OK = (Bool) 0。} x。struct foo{ unsigned a:1, b:2。 in Boolean context) Global Wrapup error 900: (Note Successful pletion, 1 messages produced)Tool returned code: 1例2://lint strong( AJXb, Bool )//lint strong( AJX, BitField )include typedef int Bool。 // Warning}則提示:PClint for C/C++ (NT) Ver. , Copyright Gimpel Software 19852001 Module: D:\PCLint\MyTest\Test1\ if(a)D:\PCLint\MyTest\Test1\(7): error 640: (Warning Expected strong type 39。Bool gt(int a,int b){ if(a) return a b。 // OK else return (Bool)0。 in context: return) Global Wrapup error 900: (Note Successful pletion, 1 messages produced)Tool returned code: 1改為://lint strong(Ab,Bool)include typedef int Bool。 // WarningD:\PCLint\MyTest\Test1\(8): error 632: (Warning Assignment to strong type 39。 // OK else return 0。例1://lint strong(Ab,Bool)include typedef int Bool。amp。n39。stop39。Count39。 }PClint for C/C++ (NT) Ver. , Copyright Gimpel Software 19852001 Module: D:\PCLint\MyTest\Test1\ n = stop 。 Bool stop。typedef int Bool。 //... n = stop 。void main(){ Count n。}LINT對(duì)象模塊Please Note. Lint Object Modules are used solely to improve the speed of processing previously linted modules and the speed improvements are only noticeable with very large files. They do not offer any additional error checking. In fact some error checking is lost as the Lint Object Modules do not retain all the information present in the original source code.強(qiáng)類型例:include typedef int Count。 (line 13, file ) not referenced) error 900: (Note Successful pletion, 1 messages produced)Tool returned code: 1,因?yàn)槭褂昧?://lint w3//lint vf//lint +libh( )include include void main(){ printf( hello world\n )。}PClint for C/C++ (NT) Ver. , Copyright Gimpel Software 19852001 Module: D:\PCLint\MyTest\Test1\ Including file (hdr) Including file C:\Program Files\Microsoft Visual Studio\VC98\Include\ (library) Global Wrapup(13): error 755: (Info global macro 39。 (pare with line 285, file C:\Program Files\Microsoft Visual Studio\VC98\Includ