www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - Pointer Incrementation Problem - DAYSAGOF.C

reply Paul <Paul_member pathlink.com> writes:
Hi Walter, I have a problem with my pointer not incrementing
smoothly, one record to the next.  (see code below)
While stepping through an array and watching in the data/object
window, the following is happening. (Imagine array numbered 1 to 10)

records
1,2,0,0,5,6,0,0,9,10....etc.  So it misses some records yet catches
up, later. This is causing my pointer to go past the end of the array and 
my program crash.

race_ctr = 0;			     /* find this race */
while( this_race_ptr->ref != this_run_ptr->ref
&& race_ctr < race_file_size )            
{
race_ctr++;                                 
this_race_ptr++;
}

The program compiles with no errors or warning messages.  It's target is 
Windows 95 and Console.

Maybe a clue here:  When trying to locate the bug, after assigning
"this_race_ptr" to the "racemem_ptr" (allocated memory)
the following increment statements had no effect.  this_race_ptr++; 
(and the following) this_race_ptr += (race_file_size);  Yet on other
pointers in the same location (after declaration, not in while loop)
they work as they should?

I have attached the source file.

Any help very much appreciated.

Paul







begin 0644 DAYSAGOF.C
M+RH 4')O9W)A;2!T;R!C86QC=6QA=&4 =&AE(&1A>7-A9V\ 96QA<'-E9"!F
M;W( 96%C:"!R=6YN97( :6X <G5N;F5R<R!F:6QE+ T*("` 1&5S:6=N960 
M9F]R($9L870 <V5A<V]N<R!O;FQY('5S:6YG(%-M87)T<VEG($1A=&$ ,3$O
M,# O,C`P,2`J+PT*#0HC:6YC;'5D92`\<W1D:6\N:#X-"B-I;F-L=61E(#QS
M=&1L:6(N:#X-"B-I;F-L=61E(#QC;VYI;RYH/ T*(VEN8VQU9&4 (FAO<G-E
M<RYH( T*#0IS=')U8W0 <G5N;F5R<R`J(')U;FYE<E]A;&QO8RAS=')U8W0 
M<G5N;F5R<R`J<G5N;65M7W!T<BP ;&]N9R`J<G5N<VEZ95]P='(L#0H ("` 
M("` 1DE,12`J<G5N;F5R7V9P*3L-"G-T<G5C="!R86-E<R`J(')A8V5S7V%L
M;&]C*'-T<G5C="!R86-E<R`J<F%C96UE;5]P='(L;&]N9R`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("` ("`F)B!L
M87-T7W)A;E]P='( /B!R=6YM96U?<'1R("D-"B` ("` ("![#0H)("` ("` 
M;&%S=%]R86Y?<'1R+2T[#0H ("` ("` ?0T*#0H ("` (&EF*"!L87-T7W)A
M;E]P='(M/FAO<G-E(#T]('1H:7-?<G5N7W!T<BT^:&]R<V4 *0T*("` ("![
M#0H-"B` ("` ("` <F%C95]C='( /2`P.PD)"2` ("` +RH 9FEN9"!T:&ES
M(')A8V4 *B\-"B` ("` ("` =VAI;&4H('1H:7-?<F%C95]P='(M/G)E9B`A
M/2!T:&ES7W)U;E]P='(M/G)E9 T*("` ("` ("` ("` ("`F)B!R86-E7V-T
M<B`\(')A8V5?9FEL95]S:7IE("D ("` ("` ("` ("`O*BHJ*BHJ*BHJ*BHJ
M*B!"=6< 2&5R92`J*BHJ*BHJ*BHJ*BHO#0H ("` ("` ('L-"B` (`D ("` 
M("` <F%C95]C='(K*SL ("` ("` ("` ("` ("` ("` ("` ("` ("` ("` 
M("`O*B!R86-E<R!F:6QE(&YO="!G;VEN9R!T;R`U,#<S("HO#0H)("` ("` 
M('1H:7-?<F%C95]P='(K*SL-"B` ("` ("` ?0T*#0H ("` ("` (')A8V5?
M8W1R(#T ,#L)"0D ("` ("\J(&9I;F0 ;&%S="!R86-E("HO#0H ("` ("` 
M('=H:6QE*"!L87-T7W)A8V5?<'1R+3YR968 (3T ;&%S=%]R86Y?<'1R+3YR
M968-"B` ("` ("` ("` ("` ("8F(')A8V5?8W1R(#P <F%C95]F:6QE7W-I
M>F4 *0T*("` ("` ("![#0H (`D ("` ("` <F%C95]C='(K*SL-"B` "2` 
M("` ("!L87-T7W)A8V5?<'1R*RL[#0H ("` ("` ('T-" T*("` ("` ("!R
M86-E7V-T<B`](#`[("` ("` ("` ("` ("` ("` +RH ;6]V92!P='( :6X 
M9&%Y<U]A<G)A>2`J+PT*("` ("` ("!W:&EL92  *G1H:7-?9&%Y<V%G;U]P
M='( (3T =&AI<U]R86-E7W!T<BT^9&%T92`I#0H ("` ("` ("` ("` ("!T
M:&ES7V1A>7-A9V]?<'1R*RL[#0H-" D)"0D)("` ("\J(&UO=F4 <'1R(&EN
M(&1A>7-?87)R87D *B\-"B` ("` ("` =VAI;&4H("IL87-T7V1A>7-A9V]?
M<'1R("$](&QA<W1?<F%C95]P='(M/F1A=&4 *0T*("` ("` ("` ("` ("` 
M(&QA<W1?9&%Y<V%G;U]P='(K*SL-" T*#0H ("` ("` (&EF*"!L87-T7V1A
M>7-A9V]?<'1R(#P =&AI<U]D87ES86=O7W!T<B`I#0H ("` ("` ("` ("` 
M("!T:&ES7W)U;E]P='(M/F1A>7-A9V\ /2`H=&AI<U]D87ES86=O7W!T<B`M
M(&QA<W1?9&%Y<V%G;U]P='(I.PT*#0H ("` ('T-"B` ("` 9&]N95]C='(K
M*SL-"B` ("!T:&ES7W)U;E]P='(M+3L-"B` ("!L87-T7W)A;E]P='( /2!T
M:&ES7W)U;E]P='([#0H ("` ;&%S=%]R86Y?<'1R("TM.PT*("` ('1H:7-?
M9&%Y<V%G;U]P='( /2!D87ES7V%R<F%Y.PT*("` (&QA<W1?9&%Y<V%G;U]P
M='( /2!D87ES7V%R<F%Y.PT*("` ('1H:7-?<F%C95]P='( /2!R86-E;65M
M7W!T<CL-"B` ("!L87-T7W)A8V5?<'1R(#T <F%C96UE;5]P='([#0H ("` 
M<')I;G1F*")<;B5D(BQD;VYE7V-T<BD[#0H ("!]+RH 96YD(&]U="!W:&EL
M92`J+PT*#0H-"B` (&EF*"!F=W)I=&4H<G5N;65M7W!T<BQR=6Y?9FEL95]S
M:7IE("H <VEZ96]F*'-T<G5C="!R=6YN97)S*2PQ+&YE=U]F<"D (3T ,2D-
M"B` ('L-"B` ("` ('!R:6YT9B B17)R;W( =W)I=&EN9R!T;R!F:6QE+BXN
M17AI=&EN9R(I.PT*("` ("` 97AI=" Q*3L-"B` ('T-" T*("` 9G)E92AR
M=6YM96U?<'1R*3L-"B` (&9R964H<F%C96UE;5]P='(I.PT*#0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?0T*#0IV;VED(')E861?
M97)R;W(H8VAA<B`J(&9I;&5?;F%M92D-"GL-"B` ('!R:6YT9B B1FEL92!R
M96%D:6YG(&5R<F]R("5S+BXN17AI=&EN9R(L9FEL95]N86UE*3L-"B` (&5X
-:70H,2D[#0I]#0H-"B5S
`
end
Nov 10 2003
parent "Walter" <walter digitalmars.com> writes:
I'd start by loading the program up with printf's to trace its execution.

"Paul" <Paul_member pathlink.com> wrote in message
news:booboh$r0i$1 digitaldaemon.com...
 Hi Walter, I have a problem with my pointer not incrementing
 smoothly, one record to the next.  (see code below)
 While stepping through an array and watching in the data/object
 window, the following is happening. (Imagine array numbered 1 to 10)

 records
 1,2,0,0,5,6,0,0,9,10....etc.  So it misses some records yet catches
 up, later. This is causing my pointer to go past the end of the array and
 my program crash.

 race_ctr = 0;      /* find this race */
 while( this_race_ptr->ref != this_run_ptr->ref
 && race_ctr < race_file_size )
 {
 race_ctr++;
 this_race_ptr++;
 }

 The program compiles with no errors or warning messages.  It's target is
 Windows 95 and Console.

 Maybe a clue here:  When trying to locate the bug, after assigning
 "this_race_ptr" to the "racemem_ptr" (allocated memory)
 the following increment statements had no effect.  this_race_ptr++;
 (and the following) this_race_ptr += (race_file_size);  Yet on other
 pointers in the same location (after declaration, not in while loop)
 they work as they should?

 I have attached the source file.

 Any help very much appreciated.

 Paul
Nov 10 2003