Timmy Brolin wrote:
> There is a very good reason why ip_addr2 was introduced. 
> ip_addr2 is in fact a decent solution. It is generates close 
> optimal machine code, it is not compiler dependent, and it 
> makes the code nice and easy to read.
> I would suggest that it remains unless someone comes up with 
> a better solution which does not break compatibility with any 
> compilers.

I disagree that ip_addr2 is in any way elegant, self-explanatory, easy to read
(being defined elsewhere but not used elsewhere), or that it necessarily
compiles to two half-word transfers, or that performance is remotely critical
here.  Worse, it's not acceptable code in C99.  People are changing it to
trivial memcpy because:

etharp.c:493: warning: dereferencing type-punned pointer will break
strict-aliasing rules
*(struct ip_addr2 *)&sipaddr = hdr->sipaddr;

Regards,
Curt McDowell
Broadcom Corp.





_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to