RE: Endian mode and hPutBuf & hGetBuf

There would be a similar problem with hPutArray and hGetArray if they were used for reading writing arrays of words other than Word8 (using castIOUArray perhaps?)
hPutArray and hGetArray do indeed generate non-portable files, and they should be documented as such.
Oops, I lied. hPutArray and hGetArray work on arrays of Word8 only, so in order to get non-portable results you need to use castIOUArray, which is already documented as having undefined behaviour. Cheers, Simon

On Wednesday 08 January 2003 2:32 pm, Simon Marlow wrote:
Oops, I lied. hPutArray and hGetArray work on arrays of Word8 only, so in order to get non-portable results you need to use castIOUArray, which is already documented as having undefined behaviour.
I guess you must mean it's behaviour has not been defined yet. (Or is it's behaviour undefined by definition? :-) I tried to use it recently to save an IOUArray of Word32's to a file by castIOUArray'ing it to an IOUArray of Word8's and using hPutArray (AFAICS the only possible way to do this using the current library functions). It didn't work. For an array of N Word32's using N as the argument to hPutArray only gave me the first N/4 Word32's in the file. Using 4N gave me an error message about buffers. So I ended up not using an IOUArray at all :-( Regards -- Adrian Hey
participants (2)
-
Adrian Hey
-
Simon Marlow