Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Travis Siegel via fpc-pascal
No, the original post has the correct program, dropping a ";" in that 
spot is incorrect syntax.


The problem comes in because there is an open comment, but no close 
comment.  If you add the closing } the compiler behaves properly.


On the other hand, I do understand that once the "end." is encountered, 
further processing is unnecessary, and so the error shouldn't occur, 
because any text showing up after that should be ignored.


Honestly, it's is a case of six of one, half dozen of the other. It's 
all in the design of the compiler.  I personally wouldn't consider it a 
bug, but I can see why some folks would, so 



On 2/8/2024 7:01 PM, Martin Wynne via fpc-pascal wrote:

Hi Thomas,

The error is not the file content after "end.".

The error is not having the expected "end;" after "begin".

This works ok:

_

program test;

begin
end;

end.

abc 123

_

Martin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Sven Barth via fpc-pascal
Martin Wynne via fpc-pascal  schrieb am
Do., 8. Feb. 2024, 22:03:

> Hi Thomas,
>
> The error is not the file content after "end.".
>
> The error is not having the expected "end;" after "begin".
>
> This works ok:
>
> _
>
> program test;
>
> begin
> end;
>
> end.
>
> abc 123
>

If that works then that is a bug as well, because the begin of the main
*must* be terminated with a "end.", not a "end;".

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-08 Thread Jonas Maebe via fpc-pascal

On 05/02/2024 01:31, James Richters via fpc-pascal wrote:

So I need to do this?
AA = Extended(8427+Extended(33/Extended(1440.0)));


Just typecasting 1440.0 to extended should be enough.


This is inconsistent,  why didn't the 1440.1 version reduce to a single?


Because 1440.1 cannot be represented exactly as a single precision 
floating point number. Nor as a double or extended precision floating 
point number for that matter, and in that case the compiler uses the 
maximum precision is supported by the target platform.




Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-08 Thread Jonas Maebe via fpc-pascal

On 06/02/2024 16:23, James Richters via fpc-pascal wrote:
Great if -CF80 worked, but even if you are happy with -CF64, my problem 
is: how is anyone coming into FPC after 2.2 supposed to know that their 
constants that always worked before are going to no longer be accurate??


By reading the release notes for that compiler version (aka the "user 
changes" wiki doc).



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Thomas Kurz via fpc-pascal
Hello Martin,

I've been using Pascal for more than 30 years now, but I must admit I've never 
before seen the construct you posted.

And it doesn't compile either:

project1.lpr(4,4) Error: Syntax error, "." expected but ";" found

Kind regards,
Thomas


- Original Message - 
From: Martin Wynne via fpc-pascal 
To: fpc-pascal@lists.freepascal.org 
Sent: Thursday, February 8, 2024, 20:01:17
Subject: [fpc-pascal] "Unexpected end of file" when having an open comment 
after the final "end."

Hi Thomas,

The error is not the file content after "end.".

The error is not having the expected "end;" after "begin".

This works ok:

_

program test;

begin
end;

end.

abc 123

_

Martin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Martin Wynne via fpc-pascal

Hi Thomas,

The error is not the file content after "end.".

The error is not having the expected "end;" after "begin".

This works ok:

_

program test;

begin
end;

end.

abc 123

_

Martin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Sven Barth via fpc-pascal
Thomas Kurz via fpc-pascal  schrieb am
Do., 8. Feb. 2024, 13:31:

> Hello all,
>
> I'm unsure about whether or not to report this as a bug. Imho, it is a
> bug, but maybe there's a good reason to handle this.
>

Please report a bug.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Thomas Kurz via fpc-pascal
Hello all,

I'm unsure about whether or not to report this as a bug. Imho, it is a bug, but 
maybe there's a good reason to handle this.

Please take the following example:

---start---

program test;

begin
end.

{

---end---

Result:

Z:\>ppc386.exe testproj.pas
Free Pascal Compiler version 3.2.2 [2022/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling testproj.pas
testproj.pas(6,1) Fatal: Unexpected end of file
Fatal: Compilation aborted


I'd say the code should compile without any errors for the following reasons:

1. The "end." tells the compiler that the file is finished here. Whatever comes 
after this should not be considered by the compiler.
2. The compiler doesn't consider any other statement after "end.". For example, 
replacing the open comment with something like "vra" doesn't cause an error 
either.

Kind regards,
Thomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal