GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #9122

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: Mirsad Todorovac
Subject: range check test programs
Date: 30 Jul 2003, 15:30:14

On Wed, 30 Jul 2003, Peter N Lewis wrote:

> On the subject of range checking, another difference that Mac Pascals
> implemented was unrangechecked arrays where the lower and upper bound
> are both 0.
>
> That is:
>
> type UnboundArray = array[0..0] of Whatever;
>
> disables the range check tests for array access.
>
> Generally this is used for open arrays as parameters, and it pretty
> much just avoids having to define a specific maximum array size
> (which can also get in to trouble, such as:
>
> type UnboundArray = array[0..kMaxInt] of Whatever;
>
> which can have a size bigger than 4Gig if Whatever has any noticeable
> size, and which can cause problems (does GPC handle record/array
> sizes larger than 32 bits on 32 bit platforms?).
>
> Anyway, I don't know that this is worth emulating even with
> --mac-pascal turned on, but I figured I'd mention it while I thought
> of it and while range checks were being discussed.

(I'm sorry if this has been discussed in Dec/2002, I couldn't find in
archives.)

Perhaps it's worth a spare attribute or two, such as

	attribute(norange);

and

	attribute(mustrange);

(the names are not obligatory part of suggestion).

They'd allow finer-grained range checking control than {R+} and {R-},
per object or per entity. Of course, if that's not too much trouble for
Frank.

I hope it's not adding too much complexity to the compiler. In ideal case,
every particular type of range check might be turned on/off independently.
OTOH, you might consider it an overkill, as GNU Pascal is not used for
programming Mars vehicles anyway (-;

I've read about some researches telling how most often errors are so
called "of by one" errors, and IMHO is thus a vital part of chasing bugs
out of the program, triggering an error exactly where it occurs, not
segfaulting miles of code later.

Have a nice day,
Mirsad

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


Replies

Author Subject Date
Frank Heckenbach range check test programs 30 Jul 2003, 21:55:38

In reply to

Author Subject Date
Peter N Lewis range check test programs 30 Jul 2003, 11:58:08

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).