home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
splint3s.zip
/
splint-3.0.1.6
/
test
/
constannot.c
< prev
next >
Wrap
Text File
|
2001-07-24
|
361b
|
23 lines
/*@constant int MaxLength=20@*/
# define MaxLength 20
void foo (char *str) /*@requires maxSet(str) >= MaxLength@*/
{
str[20] = 'a';
}
void foo2 (char *str) /*@requires maxSet(str) >= (MaxLength - 1)@*/
{
str[20] = 'a'; /* error */
}
void foo3 ()
{
char buf[MaxLength];
buf[0] = '\0';
foo (buf); /* error: off by 1 */
foo2 (buf); /* okay */
}