Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-06

Re: fpc-pascal Digest, Vol 72, Issue 35

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roger Bailey
Michael Van Canneyt wrote 14 lines
>> TestFunction := ActualParameter ( ) ; { compiles and runs o.k. } >> > [MVC:] The addition of () actually calls the function. >> TestFunction := ActualParameter ; { gives "incompatible type" error, but ... } [MVC:] Here you try to assign the ActualParameter (a function pointer) to the result (an integer). This of course gives a type error. >> TestFunction := NamedFunction ; { ... compiles and runs o.k. } [MVC:] This is simply a regular function call.

Sorry, but this simply wrong. The LRG (page 95) does not require an "actual parameter list" for a syntactically correct function call.

The call should be excecuted except in one case (LRG page 96) "... the compiler will not execute the function call ... when assigning a value to a procedural type variable". This is clearly not such a case.

Roger Bailey

P.S. The LRG has a minor error on page 121: "out parameter" appears twice as an alternative for "parameter declararion"

Reply by email

Michael Van Canneyt
to Roger Bailey
Roger Bailey wrote 18 lines
On 12 Jun 2010, at 11:00, Michael Van Canneyt wrote: >>> TestFunction := ActualParameter ( ) ; { compiles and runs o.k. } >>> >> > [MVC:] The addition of () actually calls the function. > >>> TestFunction := ActualParameter ; { gives "incompatible type" error, but ... } > > [MVC:] Here you try to assign the ActualParameter (a function pointer) to the > result (an integer). This of course gives a type error. > >>> TestFunction := NamedFunction ; { ... compiles and runs o.k. } > [MVC:] This is simply a regular function call. Sorry, but this simply wrong. The LRG (page 95) does not require an "actual parameter list" for a syntactically correct function call.

What is simply wrong ? My explanation or the behaviour of the compiler ?

Michael.

Reply by email