Hello for all.
Sorry, if my question is too dumb, but I just started to make interest in GPC in the last few days. I'm advanced in Pascal language, I used Turbo Pascal and Borland Delphi before. But I haven't used GPC before, and I'm really not advanced in Unix-based operating systems.
I'm trying to compile one of my projects under Debian Linux with GPC, but it stops with an error message, that GPC doesn't know the Hi and Lo functions. I don't know that they are present in GPC in another unit, or not. I think some functions that supports the same thing must be there.
Here's the purpose of the mentioned funtions:
function Hi(X: word): byte; function Hi(X: integer): byte;
Hi function returns the high-order byte of the specified word or 16-bit integer.
function Lo(X: word): byte; function Lo(X: integer): byte;
Lo function returns the low-order byte of the specified word or 16-bit integer.
MegaBrutal a écrit:
Hello for all.
Sorry, if my question is too dumb, but I just started to make interest in GPC in the last few days. I'm advanced in Pascal language, I used Turbo Pascal and Borland Delphi before. But I haven't used GPC before, and I'm really not advanced in Unix-based operating systems.
I'm trying to compile one of my projects under Debian Linux with GPC, but it stops with an error message, that GPC doesn't know the Hi and Lo functions. I don't know that they are present in GPC in another unit, or not. I think some functions that supports the same thing must be there.
Here's the purpose of the mentioned funtions:
function Hi(X: word): byte; function Hi(X: integer): byte;
Hi function returns the high-order byte of the specified word or 16-bit integer.
function Lo(X: word): byte; function Lo(X: integer): byte;
Lo function returns the low-order byte of the specified word or 16-bit integer.
gpc is a 32/64 bits compiler, so that the meaning of Hi is ambiguous. But you can put in your program
uses system;
this unit gives specific BP compatibility functions, in particular Hi and Lo: the ambiguity is solved by saying Hi is the next to last byte (not the higher order byte).
Maurice
I thought the system unit is imported automatically, and I don't have to care for it by list it in the uses clause. :S It's good to know, thx. Now it still doesn't want to compile my program. (No prob with Hi and Lo now, but another error is occurred.) I'm trying to figure out the problem, and I'll write again if I can't find a solution.
2007/5/4, Maurice Lombardi Maurice.Lombardi@ujf-grenoble.fr:
uses system;
this unit gives specific BP compatibility functions, in particular Hi and Lo: the ambiguity is solved by saying Hi is the next to last byte (not the higher order byte).
MegaBrutal a écrit:
I thought the system unit is imported automatically, and I don't have to care for it by list it in the uses clause. :S
This is the case for BP, but not for GPC (in this case it is only a BP compatibility unit, unused in "normal" cases).
Maurice
Maurice Lombardi wrote:
MegaBrutal a écrit:
I thought the system unit is imported automatically, and I don't have to care for it by list it in the uses clause. :S
This is the case for BP, but not for GPC (in this case it is only a BP compatibility unit, unused in "normal" cases).
Indeed. If you look at GPC's System unit, you'll see that it only contains rather obscure functions. And Hi/Lo are in this category, as Maurice explained, since the notion of "high byte" is problematic. In fact if it's only about Hi/Lo, you might want to use explicit code (such as that contained in the System unit), to make it clearer in your code what you mean.
BTW, you can auto-use the System (or any other) unit by adding the parameter "--uses=System" to your command-line. But I wouldn't recommend it unless absolutely necessary.
I thought the system unit is imported automatically, and I don't have to care for it by list it in the uses clause. :S It's good to know, thx. Now it still doesn't want to compile my program. (No prob with Hi and Lo now, but another error is occurred.) I'm trying to figure out the problem, and I'll write again if I can't find a solution.
BTW, have you looked at the chapter "Borland Pascal" in the GPC manual? It addresses some more or less common issues. In particular the section "BP Incompatibilities" contains some differences and how to change some of them via options when necessary.
Frank