std C/C++ patch #9
Eddie Kohler
kohler at icir.org
Sat Apr 27 14:56:11 EDT 2002
Hi Scott,
Patches #6 and #9 are now in. As far as I know, this leaves only
__attribute__((packed)).
It seems to me like we need to figure out two things for
__attribute__((packed)):
1. What to do about sizeof(click_ether)?
It would be OK, but very annoying, to deprecate sizeof(click_ether), I
suppose -- and, similarly, sizoef(click_ip), etc. -- and move to some
macro convention. :P
2. What about structures that actually need to be packed (i.e., they
contain unaligned uint32_ts et al.)?
I don't want to fix this one without help from the compiler. One could
write lovely macros for accessing unaligned integers, but, in a word,
barf.
I think what I'd like to do here is wait to see if the relevant compilers
support what we need. Does KCC/Sun CC have a #pragma that would let
sizeof(click_ether) == 14, and allow unaligned accesses within a particular
kind of structure? If so, we'll need to decide on a set of macros that
work on any compiler.
Eddie
More information about the click
mailing list