On Jul 24, 2013, at 08:11 , Vipul Nayyar <nayyar_vi...@yahoo.com> wrote:

> Hello Peter,
> 
> Thanks for the heads up. I put the cast their initially because the compiler 
> gave me a warning that interrupt handler install function argument 4 requires 
> a rtems_interrupt_handler type. 
> 
> So can you tell me, what is the right way to go about this ? What kind of 
> problems can be caused ? How do I make sure that I'm actually fixing that 
> part of code ?
> 


It varies from case to case.  For warnings about a function mismatch I usually 
introduce a "shim" function in preference to casting, for example, the 
prototype for a pthread function is
"void *handler(void *);"  so to call "void fred(void)" I might add a 
call_fred() shim:

static void *call_fred(void *unused) {
        fred();
        return (void *)0;
}

I try to only pass opaque type pointers via a void * and not some other unknown 
type.

For variables I'll introduce a temporary. Obviously you never want to cast a 
pointer to an integer to be a pointer to a double to silence a cast.

etc.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to