[fpc-devel]let Pascal stay Pascal

Andrzej Gąsienica-Samek ags at qdnet.pl
Fri Oct 27 12:35:28 CEST 2000


Hi there!

I found something that drives me mad, and besides that I found a little bug
in the compiler. First thing. I know Pascal really well and I had to write
something in PPC. Simplest possible example looks like this:

var
  a: Integer;

function fact: Integer;
begin
  fact := 1;
  if a <> 0 then
  begin
    Dec(a);
    fact := (a+1)*fact;
  end;
end;

begin
  a := 3;
  Writeln(fact);
end.

Of course it will write 6, and give the variable "a" value 0. Not in PPC. I
think that Pascal should stay Pascal, not C or C++. When you add C-like
operators - ok. It'll be harder to read code for others, it'll not be easier
to write code, but it's your choice. But all basic concepts must be in
harmony with Wirth's Pascal. Result variable is really convenient, but in
Delphi. Borland gives the result variable one name for all functions -
"Result". It's much clearer and easier to use it than using function name
all the time. It's easier than to change function name. But using the name
of a parameter-less function not in assignment in that function must always
call it. Let Pascal stay Pascal...

Now the small bug I mentioned at the beginning. Compiling program with
PPC386 for Win95:

var
  a: Comp;
begin
  a := 2E40;
end.

gives error:

Free Pascal Compiler version 1.0.2 [2000/10/12] for i386
Copyright (c) 1993-2000 by Florian Klaempfl
Target OS: Win32 for i386
Compiling a.pas
a.pas(2,3) Note: Local variable A is assigned but never used
Linking a.exe
Compilation aborted :6
Runtime error 207 at 0x0043DB68
  0x0043DB68
  0x0043DD55
  0x004AAE50
  0x004AA471

waiting for the appearence of unsigned and 64-bit integers,
regards,
-Andrzej Gasienica-Samek





More information about the fpc-devel mailing list