[splint-discuss] Splint-3.1.2 bugs - Mudflap

Michael Wojcik Michael.Wojcik at MicroFocus.com
Thu Jul 31 06:41:36 PDT 2008


> From: splint-discuss-bounces at cs.virginia.edu 
> [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of 
> Richard A. O'Keefe
> Sent: Wednesday, 30 July, 2008 22:27
> 
> On 31 Jul 2008, at 1:46 pm, John Carter wrote:
> 
> > -  struct operation op;
> > +  struct operation op = {0,0,0,0,0};
> 
> This adds extra runtime overhead, but clearly does not fix 
> any real bug, unlike the other kinds of changes provided.

It's also unnecessarily verbose, since:

	struct operation op = {0};

will initialize all members of op appropriately (integer types to 0,
floating types to 0.0, pointers to null, and recursively for aggregate
types), regardless of the number of members.

The runtime overhead is negligible, and personally I'd just as soon see
automatic variables initialized; but some people prefer to avoid
initializing automatics that should be assigned only at runtime, so
analyzers can catch accidental use before assignment.

-- 
Michael Wojcik
Principal Software Systems Developer, Micro Focus



More information about the splint-discuss mailing list