This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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);

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]