Strange error message?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange error message?

John Coppens
Hi...

I was trying to compile some old TP code and got a strange error message:

program test_reg;
type
  ShTableLine= procedure(n: integer);

  procedure DummyShLine(Nr: integer);
  begin
  end;  {DummyShLine}

  procedure UseIt;
  const
    PrevProc: ShTableLine = DummyShLine;
  begin
  end;

begin
end.

This gives me the following message (referring to the 'const' line in
UseIt):

Error: Incompatible types: got "DummyShLine(SmallInt)" expected
"<procedure variable type of procedure(SmallInt);Register>"

I didn't declare the original as being 'register', why should it expect
that later? And how to solve the problem?

Thanks!

John
PS: FPC is version 2.0.2
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Strange error message?

Marc Santhoff
Am Freitag, den 07.07.2006, 14:40 -0300 schrieb John Coppens:

>     PrevProc: ShTableLine = DummyShLine;

Use

    PrevProc: ShTableLine = @DummyShLine;

to tell fpc it's an address and no function call.

Have fun,
Marc


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Strange error message?

Vincent Snijders
Marc Santhoff wrote:

> Am Freitag, den 07.07.2006, 14:40 -0300 schrieb John Coppens:
>
>
>>    PrevProc: ShTableLine = DummyShLine;
>
>
> Use
>
>     PrevProc: ShTableLine = @DummyShLine;
>
> to tell fpc it's an address and no function call.
>

or compile your code in tp mode (fpc -h for help about command line
parameters).

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Strange error message?

John Coppens
On Fri, 07 Jul 2006 20:14:13 +0200
Vincent Snijders <[hidden email]> wrote:

> or compile your code in tp mode (fpc -h for help about command line
> parameters).
>
> Vincent
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Thanks both!

I hope this gets to the list. I had found the problem just minutes after
putting the question on the net (as frequently happens), and sent a notice
to the list. I had to leave, so I didn't notice that the message bounced:

<[hidden email]>: host lists.freepascal.org
[193.224.143.26] said: 554 Service unavailable; Client host
[208.97.132.5] blocked using bl.spamcop.net; Blocked - see
http://www.spamcop.net/bl.shtml?208.97.132.5 (in reply to RCPT TO command)

Again, appreciated...

John
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal