> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Olivier FAURAX
> Sent: Friday, 08 August, 2008 09:51
> 
> I try to use splint, but I encounter parse errors everytime.
> The last time, it was on this line : void* y = (void*) 
> malloc(x); What is difficult to parse here ?

Nothing. The following is passed by splint 3.1.1 with no errors or
warnings, using the default settings:

-----
#include <stdlib.h>

static void foo(size_t x) {
   void *y = (void*) malloc(x);   /* your example */
   free(y);
}
int main(void) {
   foo(1);
   return 0;
}
-----

So presumably it is something else in your code, likely on a previous
line, which is causing the problem.

Note that casting the return value of malloc is bad practice. If a
correct declaration for malloc is in scope, its return type is void *,
which can be converted to any object pointer type on assignment. Casting
the return value of malloc only serves to hide the error of failing to
have a correct declaration in scope.

(The one exception is for code that needs to be compiled as both C and
C++. This is not common.)

-- 
Michael Wojcik
Principal Software Systems Developer, Micro Focus

_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to