There are now two remaining warnings.

Robin Farine robin.farine at terminus.org
Wed Sep 7 17:35:50 UTC 2005


On Wed September 7 2005 16:55, Ihno Krumreich <ihno at suse.de> wrote:

> why not just write:
>
> 		case 1: *u8 =  (uint8_t)data; break;
> 		case 2: *u16 = (uint16_t)data; break;
> 		case 4: *u32 = (uint32_t)data; break;
>

The problem comes from one line a few line above

	u16 = (uint16_t *) &aligned;

which is illegal, it breaks C99 aliasing rules. But in my opinion, 
the real problem lies in the absence of clean distinction between 
marshalled data (in DHCP packets) and unmarshalled data (as 
manipulated by the CPU). Admittedly, it helps spare a few CPU 
cycles and perhaps a few bytes here and there but, on the other 
hand, it becomes difficult to avoid such contorsions.

Robin



More information about the busybox mailing list