sizeof(struct) and padding

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Oct 26 06:41:39 AEST 1990


In article <14309 at goofy.megatest.UUCP> djones at megatest.UUCP (Dave Jones) writes:
> When you write structures directly to disc, it is non-portable,
> period -- whether or not you write the tail-padding. Different machines will
> have different internal padding, even different data formats.

Sometimes you have to manually swap memory to disk for efficiency.
You're never going to use the temporary file on another machine, so the
format doesn't have to be portable. All you need is a guarantee from the
OS that memory can be written out and read back in without corruption.

I agree that the original problem is best solved with a text format.

---Dan



More information about the Comp.lang.c mailing list