On Mon, 12 Jan 2004 [EMAIL PROTECTED] wrote: > Let me give another example. > When reading DOS-type partition tables, one encounters four bytes > that give the start of a partition. Least significant byte first. > > So everybody who does not want to know how integers are represented > on the current architecture writes > start = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24); > And it just works.
Really, do you think your statement is better, clearer, or less error-prone than this: start = get_be32(p); or even: start = get_be32(&p[0]); ? Sure this requires one to know the meanings of big- and little-endian; but anybody who doesn't understand _that_ shouldn't be writing such programs anyway. Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel