[patch] libgloss/arm: Cast arguments to do_AngelSWI to int.

Paul Brook paul@codesourcery.com
Mon Dec 25 19:36:00 GMT 2006


On Sunday 24 December 2006 01:18, Nick Clifton wrote:
> Hi Kazu,
>
> >  #ifdef ARM_RDI_MONITOR
> >    int block[2];
> > -  block[0] = path;
> > +  block[0] = (int)path;
> >    block[1] = strlen(path);
>
> Rather than casting, lets do this the proper way and use a union.  After
> all this is better programming practice and avoids potential aliasing
> problems.  (Not that there should be in this particular case, but it
> never hurts to do the right thing).  ie:
>
>    union foo {
>      int i;
>      void * p;
>    } block [2];
>    block[0].p = path;
>    block[1].i = strlen (path);

You really think that's better?
If you're doing is *properly* you have separate structures for each syscall, 
and use those rather than a simple "block" array.

Paul



More information about the Newlib mailing list