Dear All,

In my program a variable is initializing by read command

As

len = read (sockfd, &hdr, sizeof (HEADER));

Here hdr is a structure 
sockfd is a socket descriptor

And after this line of code I am using a member of hdr 

As
hdr.member == 2

And Splint is showing warning

Field hdr.member used before definition
  An rvalue is used that may not be initialized to a value on some execution
  path. (Use -usedef to inhibit warning)


I think as hdr initializing at runtime that's why splint is not recognizing 
that hdr is initialized and giving the warning



Same in case of gettimeofday()
 
In program is has been used like

int var = gettimeofday(&time, &timez);

here gettimeofday() function initializing the time variable.
time variable is of type timeval structure

and after this line of code time variable is used as

time_after = time.tv_sec;

in this case also splint is behaving same as in case of read()

splint showing the following warning

Variable time used before definition
  An rvalue is used that may not be initialized to a value on some execution
  path. (Use -usedef to inhibit warning)


How does it behave for functions that really depend upon runtime?

Does it initialize the variables or not?

Does this function replace with macro/something?


Thanks and Regards
 
Vishal Bayskar
 
Ext. no. 927


-----Original Message-----
From: Ludolf Holzheid [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 29, 2008 12:45 AM
To: [email protected]
Cc: Vishal Bayskar
Subject: Re: [splint-discuss] Dependency on run time function

On Fri, 2008-03-28 12:48:44 +0530, Vishal Bayskar wrote:
> Dear All,
> 
>             How does splint react for function that depend upon runtime 
> 
>             Like read(), gettimeofday(), calloc().

Vishal,

Proper functions depend on run time, of course. You wouldn't want to
invoke a program always producing the same results. ;-)

Joking aside, what do you think is special with these functions (and
what do you expect splint to do with them)?

Ludolf

-- 

---------------------------------------------------------------
Ludolf Holzheid             Tel:    +49 621 339960
Bihl+Wiedemann GmbH         Fax:    +49 621 3392239
Floßwörthstraße 41          e-mail: [EMAIL PROTECTED]
D-68199 Mannheim, Germany
---------------------------------------------------------------


_______________________________________________
splint-discuss mailing list
[email protected]
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to