Vale The test on array of char seem not works for array of four char. Here there is a simple source, whit five test and where one is falling:
program Prx; var a5: array[1..5] of char := '01960'; b5: array[1..5] of char := '01959'; a4: array[1..4] of char := '1960'; b4: array[1..4] of char := '1959'; as: string(4) := '1960'; bs: string(4) := '1959'; begin writeln('Test array of char'); if a5 <= '01959' then writeln('failed! array 5 - costant'); if a5 <= b5 then writeln('failed! array 5'); if a4 <= '1959' then writeln('failed! array 4 - costant'); {above the falling test?} if a4 <= b4 then writeln('failed! array 4'); if as <= bs then writeln('failed! string'); end.
The work session is:
C:\fsf\pascal>uname -a MS-DOS X6J0B4 8 00 pc
C:\fsf\pascal>gpc -v Reading specs from c:/fsf/lib/gcc-lib/djgpp/2.952/specs gpc version 20001101, based on 2.95.2 19991024 (release)
C:\fsf\pascal>gpc prx.pas
C:\fsf\pascal>a Test array of char failed! array 4
C:\fsf\pascal>
Best regards G. Rossati
rossati@libero.it a écrit:
Vale The test on array of char seem not works for array of four char. Here there is a simple source, whit five test and where one is falling:
C:\fsf\pascal>gpc -v Reading specs from c:/fsf/lib/gcc-lib/djgpp/2.952/specs gpc version 20001101, based on 2.95.2 19991024 (release)
No more problem with the last version of gpc. (20020910) Please install it. The last binary for djgpp is maintained under the fixed link:
http://gnu-pascal.de/contrib/maurice/gpc2953b.zip
Maurice
Maurice Lombardi wrote:
... snip ...
No more problem with the last version of gpc. (20020910) Please install it. The last binary for djgpp is maintained under the fixed link:
BTW, what (if any) is the corresponding ftp link?
CBFalconer wrote:
Maurice Lombardi wrote:
The last binary for djgpp is maintained under the fixed link:
BTW, what (if any) is the corresponding ftp link?
There is no (official) FTP server anymore. Is the HTTP download a problem for you?
Frank
Frank Heckenbach wrote:
CBFalconer wrote:
Maurice Lombardi wrote:
The last binary for djgpp is maintained under the fixed link:
BTW, what (if any) is the corresponding ftp link?
There is no (official) FTP server anymore. Is the HTTP download a problem for you?
No, just that the ftp is often more convenient.
Hi,
On Mon, Nov 04, 2002 at 11:51:21PM +0200, rossati@libero.it wrote:
Vale The test on array of char seem not works for array of four char. Here there is a simple source, whit five test and where one is falling:
program Prx; var a5: array[1..5] of char := '01960'; b5: array[1..5] of char := '01959'; a4: array[1..4] of char := '1960'; b4: array[1..4] of char := '1959'; as: string(4) := '1960'; bs: string(4) := '1959'; begin writeln('Test array of char'); if a5 <= '01959' then writeln('failed! array 5 - costant'); if a5 <= b5 then writeln('failed! array 5'); if a4 <= '1959' then writeln('failed! array 4 - costant'); {above the falling test?} if a4 <= b4 then writeln('failed! array 4'); if as <= bs then writeln('failed! string'); end.
It works fine for me. Consider upgrading the compiler, you use a very old version and that is probably the root of the problem:
Reading specs from c:/fsf/lib/gcc-lib/djgpp/2.952/specs gpc version 20001101, based on 2.95.2 19991024 (release)
Anyway, it is surprising for me that gpc accepts this code at all. Only _packed_ arrays of char should behave like strings, and AFAIK the Borlandish substitute for `value' should be `=', not `:=' (an undocumented feature?).
Emil Jerabek
Emil Jerabek wrote:
On Mon, Nov 04, 2002 at 11:51:21PM +0200, rossati@libero.it wrote:
Vale The test on array of char seem not works for array of four char. Here there is a simple source, whit five test and where one is falling:
program Prx; var a5: array[1..5] of char := '01960'; b5: array[1..5] of char := '01959'; a4: array[1..4] of char := '1960'; b4: array[1..4] of char := '1959'; as: string(4) := '1960'; bs: string(4) := '1959'; begin writeln('Test array of char'); if a5 <= '01959' then writeln('failed! array 5 - costant'); if a5 <= b5 then writeln('failed! array 5'); if a4 <= '1959' then writeln('failed! array 4 - costant'); {above the falling test?} if a4 <= b4 then writeln('failed! array 4'); if as <= bs then writeln('failed! string'); end.
It works fine for me. Consider upgrading the compiler, you use a very old version and that is probably the root of the problem:
Reading specs from c:/fsf/lib/gcc-lib/djgpp/2.952/specs gpc version 20001101, based on 2.95.2 19991024 (release)
Anyway, it is surprising for me that gpc accepts this code at all. Only _packed_ arrays of char should behave like strings,
If you compile with `--classic-pascal' or `--extended-pascal', GPC will require `packed'. Otherwise, this is not required.
and AFAIK the Borlandish substitute for `value' should be `=', not `:=' (an undocumented feature?).
AFAIR, Peter added `:=' long time ago because it's similar, but not as ambiguous as the Borlandish `='.
Frank