Am Mittwoch, 7. Februar 2007 08:00 schrieb David Brownell:
> > In scope of (1) i can't understand: structs are padded implicitly,
> > member access is coded explicitly.
> 
> But the struct declarations in question are not memory layouts.
> 
> They're "on-the-wire" protocol structures, where the compiler
> has exactly ZERO business changing anything.  When the protocol
> spec says the field starts at byte three, that's where it starts.
> Regardless of whether, as a 16 bit field, it might trigger fewer
> alignment issues if byte three held padding instead, and that
> field started at byte 4 ...

Exactly. The problem with packed is that it really does two things.
1. Disallow any padding
2. Assume the structure may be in unaligned memory

Issue number #1 is usually handled by the USB specification.
#2 is not. Therefore packed data structures will make inferior code
even in the case we alloc the data structure ourselves.


> those developer communities differed is that the Internet stack
> is big-endian, while USB is little-endian.)

Intel being a major member of that group might be rather persuasive :-)

        Regards
                Oliver

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to