[fpc-pascal] real to integer

Пётр Косаревский ppkk at mail.ru
Tue May 30 12:10:33 CEST 2006


> The compiler already gives unit information in case you have  
> conflicting types for making it easier to debug such problems. I  
> don't see why it shouldn't do the same for used function definitions.
> Jonas

program A; // "Bad" program
uses sysutils,windows;
const B:shortstring='1.txt';
begin DeleteFile(B); end.

Last compiler messages ("-va"): (all dependencies, path searching etc are before)
Searching file 1.pp... found
(A)        Load from A (implementation) unit WINDOWS
1.pp(3,1) (A)        Parsing implementation of 1.pp
1.pp(4,19) Error: Incompatible type for arg no. 1: Got "ShortString", expected "PChar"
Hint: Found declaration: DeleteFile(PChar):LongBool

program C;
uses windows,sysutils;
const B:shortstring='1.txt';
begin DeleteFile(B); end.

Last compiler messages:
Searching file 2.pp... found
2.pp(3,1) (C)        Parsing implementation of 2.pp
2.pp(2,13) Hint: Unit "windows" not used in C

I got nice hints: "Load from A (implementation) unit WINDOWS" and "Hint: Unit "windows" not used in C".

While the second hint helps me to understand, that if I wanted to run deletefile() from windows, I failed, I don't understand how to read first bunch of messages (there are lotsa "Load from A ..." messages).

Of course, if I use any function from windows unit, I don't get "Hint: ... not used ...".

This is fpc-pascal maillist, I don't insist, that I can read good. Where from had I to get my hint?



More information about the fpc-pascal mailing list