Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Runtime Error - Seeking Help Posted by TheKingfish on 31 Jan 2012 at 9:38 PM
I’m back. Still the total newbie to FPC (2.4.4), but now seeking some runtime error help. In attempting to run one of my old Turbo Pascal programs, I’m encountering a snag on FPC. I did not expect any issues with the tried-and-true code. Although a longtime user of TP, I have never fully utilized the tool offerings (monitoring, debugging, etc.). I’ve more or less slugged it out minus any peripheral assistance – the equivalent of the blind pig that eventually finds an acorn……

Over the years, I’ve often amazed myself in finding my way through the error maze. In the end I’m confident this is more a generic Pascal-programming issue than FPC. Never too old to learn the basics and the existing assist tools I guess. Anyway, here’s what I’m seeing:
Runtime error 201 at $0041662D (plus three other $ locations)

By appendix definition this has to do with something being outside of range, but I’m unsure of where to start looking. The dollar-sign location notation is unknown to me. Can anyone shine some additional light my way? Thank you.

Report
Re: Runtime Error - Seeking Help Posted by Actor on 31 Jan 2012 at 11:05 PM
I think Turbo Pascal gives this error only if range checking is on. By default it is off.

Look for a place where you have declared a sub-range, such as
var
     digit : 0 .. 9 ;

if you do this and range checking is on then any attempt to assign a value outside 0 .. 9 to digit will cause the error.

The use of pred or succ can cause this error.
var
     ch    : char ;
     upper : 'A' .. 'Z' ;
begin
     ch := succ('Z') ;


Report
Re: Runtime Error - Seeking Help Posted by TheKingfish on 7 Feb 2012 at 3:44 AM
Thanks for your input. The formal search for runtime errors within Pascal (embedded code for identifying the line number) has always seemed to be a cure worse than the disease. But that’s both (1) me and the (2) lack of ever finding a good example.

For my problem I came to recognize the error was confined to the subroutine I was evoking, as opposed to the entire former Turbo program being processed by FPC. So, I set upon the standard troubleshoot technique – methodically inserting screen-prints to identify the discrepancy location. That device worked well, and I soon had a suspect area cordoned off. Not surprising, the area was something I’d created just last year; a piece of code less-elegant than it could have been. I think we all know when that happens, but the code invariably works in the short term and we are often momentarily reluctant to invest more time. Nonetheless, this week I put the proper time into it and resolved the issue. Always a good feeling. Again, thanks for your help. The forum remains an asset, one that I much appreciate.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.