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

Mail #9239

Back to main page of archive

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

From: Mirsad Todorovac
Subject: `Val' function problems
Date: 15 Aug 2003, 11:45:08

On Thu, 14 Aug 2003, Frank Heckenbach wrote:

> Prof A Olowofoyeku (The African Chief) wrote:
> > > Mirsad Todorovac wrote:
> > >
> > > > The other side of the story is that Val could be used more flexible,
> > > > i.e. for parsing if "best effort" has been done, and string has been
> > > > converted-up to the first invalid character/digit.
> > >
> > > We could do that if we decide to interpret it as undefined.
> > >
> > > However, since `Val' is a BP function, anyway, I'd tend to change
> > > GPC's behaviour and set the number to 0. (In the case where you want to
> > > ignore the trailing garbage, it's easy to pass the prefix to `Val'
> > > again.)
> >
> > What Mirsad suggests seems to be what Delphi does (i.e., stop where the
> > error starts, and return what was possible to convert before the error -
> >  but again the Delphi help file does not document this, so I am not
> > sure that one should rely on this behaviour).
>
> Perhaps we should leave it undefined until/unless someone provides a
> reference of clearly documented behaviour of other compilers. (If
> that's what we do, please mention it in the reference, Mirsad.)

I was thinking about how having the sane part of string converted and
stored could provide extra functionality - that would add a means for the
function to be used in i.e. numerical expressions parsing at little extra
cost, since the number appears to be already converted (the right
value appears in `x' in the case of only one invalid char).

Of course, provided that this is what we want. We could OTOH want either
completely 'clean' string or nothing.

I can't tell the number of program's that do rely on BP or Delphi `Val'
undocumented behavior.

Frank?

Mirsad

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


Replies

Author Subject Date
Frank Heckenbach `Val' function problems 15 Aug 2003, 16:00:18

In reply to

Author Subject Date
Frank Heckenbach `Val' function problems 14 Aug 2003, 22:33:03

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