On Tue, Dec 8, 2009 at 03:49, David Emerson <dle...@angelbase.com> wrote:
> Of course, if you have a set of all the valid characters
> ['-', '.', '0'..'9', 'e', 'E', '+'], it's not unreasonable to restrict
> characters outside that set. But make sure the set is complete-- at
> first I overlooked "e+" which is valid for val (string, real)
>

No, it is not:

t.pas
---
var
  x: Double;
  d: Integer;
begin
  Val('e+', x, d);
  Writeln(x, ' ', d);
end.
---
dcc32 -cc t.pas
t.exe
==>
 0.00000000000000E+0000 3
---
fpc t.pas
t.exe
==>
 0.00000000000000E+000 1

So both Delphi and FPC reject 'e+' as a floating-point value,
although with different error positions.
The latter is probably a compatibility bug in FPC's Val procedure.

-- 
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to