Endian mode and hPutBuf & hGetBuf

Adrian Hey ahey@iee.org
Thu, 9 Jan 2003 06:14:08 +0000

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

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 :-(

Adrian Hey