Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-12

Range Check runtime errors

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Richters

I was recently troubleshooting a program that got a range check error and had quite a time figuring it out... it gave me the line number that generated the error... but unfortunately that line had a whole pile variables in it... it was trying to access an element of an array, with formulas to specify the elements, so I didn't know which part of this was generating the range check error. Two things could have helped me here, one would be to know which variable went out of range, and the other thing would be to know what the range was, and for that matter what value was trying to be assigned... it seems to me that the range checking routine must know the range it's checking for and it should also know what contents of the variable that triggered the error.. so why not output the value detected, the allowable range, and the variable name along with the error? It would greatly simplify tracking down bugs. Anyone have any comment of if there is a possibility of adding this information to range check errors?

James

Reply by email

Winfried Bartnick
to James Richters
James Richters wrote 7 lines
I was recently troubleshooting a program that got a range check error and had quite a time figuring it out... it gave me the line number that generated the error... but unfortunately that line had a whole pile variables in it... it was trying to access an element of an array, with formulas to specify the elements, so I didn't know which part of this was generating the range check error. Two things could have helped me here, one would be to know which variable went out of range, and the other thing would be to know what the range was, and for that matter what value was trying to be assigned... it seems to me that the range checking routine must know the range it's checking for and it should also know what contents of the variable that triggered the error.. so why not output the value detected, the allowable range, and the variable name along with the error? It would greatly simplify tracking down bugs. Anyone have any comment of if there is a possibility of adding this information to range check errors? James _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Separate your big one line into a lot of lines like

if (a > 255) and

    (B = 'Whats on ') and

       (C <0 ) and

        ......

Winni

Reply by email

Bo Berglund
to James Richters
James Richters wrote 6 lines
Great idea! Thank you for the suggestion, that sould make it very easy to track down. > Separate your big one line into a lot of lines like James

The suggestion was to make *your post* readable... As it is it consists of just a mess of words on one gigantic line with no structure and is very hard to read.
Does not invite one to help...

Bo Berglund Developer in Sweden

Reply by email

James Richters
to Bo Berglund
The suggestion was to make *your post* readable... As it is it consists of just a mess of words on one gigantic line with no structure and is very hard to read. Does not invite one to help...

A good and appreciated suggestion as well.
I honestly did not even realize my post was like that until you pointed it out and I went back to see what you were talking about.

James

Reply by email