On  2 Jul 2010, acacio.cent...@terra.com.br wrote:

> However, I've put up this code snippet to test it, and, it
> seems to me that splint should be complaining about the assignment of "i"
> to "global", as I'm creating an alias that is visible outside of func1().
> Am I getting it wrong?

Splint will not find every problem out of the box.  You must do some
work to get it to check what you wish.  Global variables are
particularly bad idea unless you have taken great care to think about
them.  That is why you should have a known interface in how they are
being used.  This is also most helpful to other programmers as they
don't have to grep the source to find every instance of where and how
the variable is used.

Short answer, follow this to it's conclusion.

- static int /*...@null@*/ *global = NULL;
+ static int /*...@null@*/ /*...@checkedstrict@*/ *global = NULL;

See section 7.2, 7.3, etc.  To find these things automatically takes a
lot of CPU as you must analyze the whole program.  The case you cite
is very simple for a human to understand, but it is not so easy to
understand the general case which a program checker should do.  So
splint's design requires you annotate your source.

hth,
Bill Pringlemeir.

-- 
Yow!  Legally-imposed CULTURE-reduction is CABBAGE-BRAINED!
_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to