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

Mail #9147

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: 4 Aug 2003, 16:48:10

On Fri, 1 Aug 2003, Frank Heckenbach wrote:

> > > These are for variables. Please add a few (not all combinations) for
> > > constants and type intializers.
> >
> > Err, I tried but I've got something illegal. I think I'll need an example
> > or two on these. (!!!)
>
> I think constants require compile-time constants, so forget about
> them. Types (`type Foo = Bar value Baz') should be relevant, though.
> (You might have to declare a variable of the initialized type in
> order to provoke the range-check error.)

Revisiting type initializers: was this what was meant?

program mir046cu;
{type with integer initializer out of bounds, upper}
uses GPC;

procedure localProc;
type Foo = Char Value 'c';
var a: Foo Value 'f';
begin
end;

procedure ExpectError;
begin
  if ExitCode = 0 then
    WriteLn ('failed')
  else
    begin
      WriteLn ('OK');
      Halt (0) {!}
    end
end;

begin
   AtExit(ExpectError);
   localProc;
end.

Thanks,
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 4 Aug 2003, 21:05:36

In reply to

Author Subject Date
Frank Heckenbach range check test programs 1 Aug 2003, 19:44:19

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).