Watch, Follow, &
Connect with Us

Developer Tools Community.

Welcome, Guest
Guest Settings

Replies: 8 - Last Post: May 19, 2015 10:58 AM Last Post By: Quentin Correll
 Posts: 2,412 Registered: 12/1/99
 Zeroing of var Posted: May 13, 2015 5:31 PM I've been fighting this for two days and am clue-less and at a complete impasse!!! Anyone have any ideas? This if statement is in a simple procedure: ``````if HiLoStep = HiLoSeqLen then // <== This simple longInt var HiLoSeqLen is "zeroed" when line 17 is executed! (???) begin if Shifted then begin case Spin of 0 : HiLoSeq[HiLoStep] := '0'; 1..18 : HiLoSeq[HiLoStep] := 'L'; 19..36 : HiLoSeq[HiLoStep] := 'H'; 37 : HiLoSeq[HiLoStep] := '0'; end; end; if ((HiLoSeq = HiLoSeqSel) and (NOT HiLoStart)) then begin HiLoStart := True; HiLoPos := SessionSpin - 1; for I := (HiLoPos - (HiLoSeqLen - 1)) to HiLoPos do HiLoStartSpins[I] := I; // *** Line 17 - Causes HiLoSeqLen to 0 when executed! Missed := 0; HiLoSeq := ''; HiLoStep := 0; Shifted := False; continue; end else begin for I := 1 to (HiLoSeqLen - 1) do HiLoSeq[I] := HiLoSeq[I+1]; HiLoSeq[HiLoSeqLen] := ' '; Shifted := True; end; end; ``````
 Posts: 9,447 Registered: 12/23/01
 Re: Zeroing of var Posted: May 13, 2015 5:58 PM   in response to: Quentin Correll Quentin Correll wrote: if HiLoStep = HiLoSeqLen then // <== This simple longInt var HiLoSeqLen is "zeroed" when line 17 is executed! (???) Sounds like you are overwriting memory, and HiLoSeqLen is the unlucky victim. But no one can diagnose that since we can't see any of your variable declarations, or where their values are coming from. for I := (HiLoPos - (HiLoSeqLen - 1)) to HiLoPos do HiLoStartSpins[I] := I; // *** Line 17 - Causes HiLoSeqLen to 0 when executed! When HiLoSeqLen is getting overwritten, what are the values of I, HiLoPos and HiLoSeqLen beforehand? What is HiLoStartSpins declared as, and does it have range checking enabled on it? Do you even have range checking turned on? -- Remy Lebeau (TeamB)
 Posts: 2,412 Registered: 12/1/99
 Re: Zeroing of var Posted: May 13, 2015 7:46 PM   in response to: Remy Lebeau (Te... Remy, Thanks for the reply. But I "fixed" it. I think your basic surmise may be correct. However, I don't know what the underlying root-cause was. I physically moved the HiLoSeqLen var definition location, re-built the app, and it came up working. I had tried with RangeChecking On and Off. Made no difference and I received no range error messages. -- Q -- XanaNews 1.19.1.372 - 2015-05-13 19:37:08
 Posts: 33 Registered: 8/9/07
 Re: Zeroing of var Posted: May 14, 2015 1:51 AM   in response to: Quentin Correll The question is whether your array is 1 or 0 based. This code suggests 1, but if it was zero based the <<<<< line could cause you problems. for I := 1 to (HiLoSeqLen - 1) do HiLoSeq[I] := HiLoSeq[I+1]; HiLoSeq[HiLoSeqLen] := ' '; <<<<<< Shifted := True; Quentin Correll wrote: Remy, Thanks for the reply. But I "fixed" it. I think your basic surmise may be correct. However, I don't know what the underlying root-cause was. I physically moved the HiLoSeqLen var definition location, re-built the app, and it came up working. I had tried with RangeChecking On and Off. Made no difference and I received no range error messages. -- Q -- XanaNews 1.19.1.372 - 2015-05-13 19:37:08
 Posts: 218 Registered: 2/7/00
 Re: Zeroing of var Posted: May 14, 2015 1:53 AM   in response to: Quentin Correll Quentin Correll wrote: I physically moved the HiLoSeqLen var definition location, re-built the app, and it came up working. Pure luck. Now you are probably overwriting something else and what it is may not show up until later.
 Posts: 64 Registered: 11/22/99
 Re: Zeroing of var Posted: May 14, 2015 7:30 AM   in response to: Uffe Kousgaard Uffe Kousgaard wrote: Pure luck. Now you are probably overwriting something else and what it is may not show up until later. That could very well be the case, those are a nightmare to detect/debug, even FastMM doesnt trigger them (unless its writing outside its allocated adresspace)
 Posts: 349 Registered: 8/2/02
 Re: Zeroing of var Posted: May 14, 2015 9:35 AM   in response to: Quentin Correll Quentin Correll wrote: I physically moved the HiLoSeqLen var definition location, re-built the app, and it came up working. I had tried with RangeChecking On and Off. Made no difference and I received no range error messages. I agree with Remy. I'd suggest you move the variable back where it was and check the values Remy suggests. I just hate "fixing" something without knowing what I fixed. -- Tredmill
 Posts: 133 Registered: 9/19/00
 Re: Zeroing of var Posted: May 14, 2015 11:45 AM   in response to: Quentin Correll Hi Q, for I := (HiLoPos - (HiLoSeqLen - 1)) to HiLoPos do HiLoStartSpins[I] := I; // *** Line 17 - Causes HiLoSeqLen to 0 when executed! When does HiLoSeqLen gets zeroed? At the first loop interaction or the last one? It's very strange that Range Check have not worked. Are you sure you're not disabling Range check in that particular unit? ClĂ©ment
 Posts: 2,412 Registered: 12/1/99
 Re: Zeroing of var Posted: May 19, 2015 10:58 AM   in response to: Clement Doss Clement, | When does HiLoSeqLen gets zeroed? At the first loop interaction or | the last one? It's very strange that Range Check have not worked. | Are you sure you're not disabling Range check in that particular unit? Sorry for the late reply but EMBT NG's has been down four days for me! I resolved the issue by moving the HiLoSeqLen definition. (I know, I know... And your last comment was on the mark. When I took a look at my Range Check I noticed that I had commented it out at the point I was working at. (I do "stuff" like that every once-in-a-while. ) So,... it's "working." However, I still don't have a clue what the root-cause is/was. But I will mess-with-it more when I have some time. Thanks for the hand-holding! -- Q -- XanaNews 1.19.1.372 - 2015-05-19 10:52:13
Legend