??????????????????2
???????????? ???????[ 2013/8/5 13:56:13 ] ????????
????lint???
????1979???????????SteveJohnson??1979??PCC(PortableCCompiler)????????????????????????Lint??????????????????淶??????(?罫“==”д????“=”)??????????????????????????????????????顣Lint?????γ??????е?????????PC-Lint/FlexeLint(Gimpel)??LintPlus(Cleanscape)???Splint.
????????
???????C/C++?????????????????????Lint?????????????????????????е???????????顣Lint??????????????????д?????????????????????ЩLint???????????????????б?:
?????????????
?????????????????????????????
???????????????
?????д????
??????0??
????????case???(?????break???)
????????????????(?????????????????)
????????????????????
???????????
???????????
??????????г????
??????????ж????(???磬if(x=0))
????printf/scanf???????
???????е?Lint??????????????汾:??PC-Lint????GimpelSoftware???????C/C++?????ó?????????:http://www.gimpel.com/html/pcl.htm??Splint(?????LCLint)???????GNU????????Lint????????c?????????c++.??????:http://www.splint.org/
????????PC-lint???????????????????????????????????????????GNU??splint?????
?????????????????????SP-lint
????Splint???????????C??????????????д????????????????ж????????:δ???????????????£????δ???????????????е?????????????????·????з????????????????
????Splint????
????1.??Linux?μ???
????1.1rpm???:
????rpm-ivh splint.xxx.rpm
????rpm????????Linux??????Redhat???????????????????????????????????????????????????к????????а????Щ????????????????????????????????????????????????Щ???????????;?????????????????????????а???????????????????в????
????1.2Ubuntu????Debian?°??
????sudoapt-get install splint
????????????£???????????????????汾????????μ????????????????????????????????---???????
????1.3??????(???)
tar -zxvf splint-3.1.2.src.gz
cd xxx/splint-3.1.2
./configure
make
makeinstall
????2.??window?°??
?????????????????????.?μ????????window?μ?????????(msi???)???????:https://github.com/maoserr/splint_win32/downloads
?????????????????Ubuntu12.04LTS??splint?????????apt-get?????????splint??汾??3.1.2?????μ??????????????????
????3.splint?????
?????????????:/*@null@*/--splint?????????????????????????????null
???????????null.c:
/*Program:null.c -- a example code for null reference error*/
//'/*@null@*/'is a special annotation the splint tool supported
char firstChar1(/*@null@*/char*s){
return *s;
}
char firstChar2(/*@null@*/char*s){
if(s ==NULL) return '