delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/24/11:45:17

From: "jansb000" <jansb000 AT wxs DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need help with very nasty bug
Date: Tue, 24 Jul 2001 17:53:40 +0200
Organization: Planet Internet
Lines: 28
Message-ID: <9jk51v$1jjmp$1@reader02.wxs.nl>
References: <9ii9h3$r9om$1 AT reader03 DOT wxs DOT nl> <9iihco$bmm$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3b4fbf4d DOT 165926315 AT news DOT primus DOT ca>
NNTP-Posting-Host: ipc3797b3d.dial.wxs.nl
X-Trace: reader02.wxs.nl 995989375 1691353 195.121.123.61 (24 Jul 2001 15:42:55 GMT)
X-Complaints-To: abuse AT wxs DOT nl
NNTP-Posting-Date: 24 Jul 2001 15:42:55 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019