[splint-discuss] Using /*@null@*/
Michael Wojcik
Michael.Wojcik at MicroFocus.com
Tue Apr 22 15:16:55 PDT 2008
> From: splint-discuss-bounces at cs.virginia.edu
> [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of
> Charles Johnson
> Sent: Tuesday, 22 April, 2008 16:48
>
> I need a little help in using the /*@null@*/ annotation. I
> can't seem to find usage in the documentation. Here is the
> code snippet:
>
> typedef struct {
> FILE *logfp;
> int Threshold;
> int FacilityList;
> } mlog_t;
>
> mlog_t mlog = { (FILE *)NULL,0,0xffffffff };
Put the annotation before the declaration of the pointer-type field that
can be null:
-----
#include <stdio.h>
typedef struct {
/*@null@*/ FILE *foo;
int bar;
int baz;
} foo_t;
foo_t foo = { NULL, 0, 0xffffffff };
-----
That suppresses the null-assignment warning and parses successfully.
(I determined this by experimentation; I don't know if it's documented
anywhere.)
--
Michael Wojcik
Principal Software Systems Developer, Micro Focus
More information about the splint-discuss
mailing list