Philip Warner <[EMAIL PROTECTED]> writes: > None, but it will be compatible with itself (the most we can hope for), and > will work even if shifting is not supported for off_t (how likely is > that?). I agree shift is definitely the way to go if it works on arbitrary > data - ie. it does not rely on off_t being an integer. Can I shift a struct?
You can't. If there are any platforms where in fact off_t isn't an arithmetic type, then shifting code would break there. I am not sure there are any; can anyone provide a counterexample? It would be simple enough to add a configure test to see whether off_t is arithmetic (just try to compile "off_t x; x <<= 8;"). How about #ifdef OFF_T_IS_ARITHMETIC_TYPE // cross-platform compatible use shifting method #else // not cross-platform compatible read or write bytes of struct in storage order #endif regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster