[splint-discuss] bzero() is not recongnized
Michael Wojcik
Michael.Wojcik at microfocus.com
Thu Mar 27 05:44:59 PST 2008
> From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of Vishal
Bayskar
> Sent: Thursday, 27 March, 2008 01:55
> There is a problem in using bzero() when I run splint command it is
not recognizing the bzero
> But there is no warning is being shown when I use memset() function
> And string.h header file is also included in the code as bzero() is
present in the string.h
No, it's not present in string.h, as far as Splint is concerned.
string.h is a standard header (it's part of the library defined by the C
standard, ISO 9899). As such, it's provided by the implementation.
Splint is a C implementation, and it supplies its own standard headers -
it doesn't use some random file on your system just because it happens
to be named "string.h".
Splint's string.h conforms to the standard. The standard does not define
a function (or other identifier) named "bzero".
You probably have some other C implementation (or something C-like, such
as GCC run in non-compliant mode) on your system, and it probably
provided a string.h that includes, in addition to the standard library
functions, a declaration for "bzero". Some implementations do this, for
historical reasons. Splint does not.
The best options for correcting this:
- Replace the use of bzero with memset in your code. bzero is
nonstandard.
- Add the following declaration to all of your source files that contain
references to bzero:
extern void bzero(char *s, int n);
(That assumes your implementation's bzero matches that declaration.
There's no guarantee of that, since bzero is not standard.) It's best to
put that declaration in a header, if bzero is used in more than one
source file.
--
Michael Wojcik
Principal Software Systems Developer, Micro Focus
More information about the splint-discuss
mailing list