lua-users home
lua-l archive

Re: checking lua using gimpel pc-lint

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> (1)
> 
> if (s==NULL || getstr(s)==NULL)
> ldump.c(63) : Info 774: Boolean within 'right side of || within if' always
> evaluates to False [Reference: file ldump.c: line 63]
> 
> getstr(s) expands to cast(const char *, (s) + 1), which expands to
> ((const char*)(s + 1)). It won't be NULL unless s == (const
> TString*)(-1). Is this possible?
No. This second test is meaningless.
> (2)
> 
> int error = GetLastError();
> loadlib.c(113) : Info 713: Loss of precision (initialization) (unsigned long to
> int)
> 
> GetLastError returns instead a DWORD type, which is normally used[2].
> Internally, DWORD is a "typedef unsigned long DWORD;" in windef.h
> despite what the MSDN docs[3] say.
Should we declare error as DWORD?
> (4)
> 
> #define SS(x) (x==1)?"":"s"
> print.c(158) : Info 773: Expression-like macro 'SS' not parenthesized
> 
> Parenthesis could be added around the macro (safer).
Fair enough.
> (5)
> 
> ldebug.c(462) : Info 750: local macro 'checkjump' (line 270) not referenced
> 
> checkjump is not referenced.
Ditto.
> (6)
> 
> lf.extraline = 0;
> lauxlib.c(578) : Warning 539: Did not expect positive indentation from line 577
> 
> Indenting is broken.
Good!
> (7)
> 
> Info 766: Header file 'D:\lib\msvs-9\VC\include\string.h' not used in module
> 'lbaselib.c'
> 
> lbaselib.c compiles here without including string.h. Does any
> compiler require string.h here?
It should not depend on the compiler. I could not find anything from
string.h used by lbaselib.c.
Many thanks for the feedback.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /