Mail Archives: djgpp/2001/07/24/11:45:17
> Actually, much can be deduced without more info. All he changed was
> the object layout and the program broke. Ergo, its behavior has a
> dependency on object layout, which is bad. Most probably, this came
> from one of three causes:
>
> * A bug involving uninitialized memory or pointer wildness; the
> program happened to always work before the spr was added perhaps
> because a padding zero was there before, or another field.
Unlikely since I reshuffeled (is this English ?) the attributes with exactly
the same result.
> * The code was unwisely depending on fields of the object being at
> certain hardcoded offsets in bytes, rather than using offsetof.
No. I never use or depend on hardcoded offsets.
> * The code was unwisely writing out and reading the objects
> byte-by-byte to and from binary files, and so the object format
> changed when the spr field was added, making the program choke on
> earlier versions' files.
Bingo!, Indeed my testprogram reads a binary file (containing this class)
written with an older (unmodified) version of the program.
Thanx for the tips!
- Raw text -