Laussy Fabrice wrote:
I am now running what I think is the up to date gpc version:
971001(2.7.2.1)
This was the last beta version. More recent versions are currently available as alpha only.
(why is the name now xgpc?)
xgpc is a temporary filename used while building gpc. With a "make pascal-install" or similar, it should be installed as gpc in the appropriate directory.
Except my misunderstanding of something, the followings are types expected to be supported by the brand new GPC: [...}
That a type "does not work" means that in my source if I put
var i, j : byte;
then GPC will yell at me:
laussy@localhost /home/laussy/conway 18:17:35 Sun Mar 1 20$ gpc --version 971001(2.7.2.1) laussy@localhost /home/laussy/conway 18:18:19 Sun Mar 1 21$ gpc byte.test.pas byte.test.pas: In function `program_Test': byte.test.pas:3: type name expected, identifier `Byte' given
Should not happen in 971001. Perhaps an installation problem:
"gpc" is only the compiler driver, the actual compiler is "gpc1". If you only installed gpc manually, but not gpc1, you're (for the most part) still using an older version, in spite of the "--version" output which is generated by gpc, not gpc1. (The version of your documentation might be due to the same reason.)
then the byte algebra is still bugged, with for example and absolute value of (2-4) given to be 252!
Did you do somehting like:
var a,b: Byte;
...
a := abs (a - b)
In this case, this is not really a bug ;-) ... it's a general problem (found in other compilers and languages, too) with unsigned and/or differently sized integers.
Since a and b are bytes, a - b will be evaluated as a byte, resulting in an overflow and the wrong result 254, of which then the absolute value is taken. Of course, in Pascal such an overflow should be caught, but GPC doesn't currently do range checking, unfortunately...
The solution would be type casting the values (or one of them) like:
a := abs (Integer(a) - b)
Not tested, but should work...
Besides, in the doc, one can find:
- The Run Time System (RTS) does not know about modified types such as `__byte__' or `__unsigned__ Integer's or `__long__ Real's. Especially, you cannot `writeln' such variables.
This has been fixed, too. BTW: the RTS is in libgpc.a, yet another file. And there's also gpc-cpp, so be sure to do a complete installation...