This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [patch] libgloss/arm: Cast arguments to do_AngelSWI to int.
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