Sign in Join

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

Mailing lists / fpc-devel / 2013-11

bug or feature?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Sergei Gorelkin

Hello together,

The following compiles and executes correctly in objfpc mode (and rejected by Delphi and by FPC in mode Delphi). Is implicit taking address of array there by design?

type
   PReal = ^Real;
const
   xa: array[0..3] of Real = (1.0,2.0,3.0,4.0);
procedure test(x: PReal);
begin
   writeln(x[3]);
end;
begin
   test(xa);   // prints 4.0e+0
end.

Regards,
Sergei

Reply by email

Paul Ishenin
to Sergei Gorelkin

22.11.2013 23:09, Sergei Gorelkin пишет:

Show quoted text 5 lines
Hello together, The following compiles and executes correctly in objfpc mode (and rejected by Delphi and by FPC in mode Delphi). Is implicit taking address of array there by design?

Yes, it is a FPC feature which is widely used by Lazarus.

Best regards,
Paul Ishenin

Reply by email

Sergei Gorelkin
to Paul Ishenin

25.11.2013 3:31, Paul Ishenin пишет:

Show quoted text 7 lines
22.11.2013 23:09, Sergei Gorelkin пишет: > Hello together, > > The following compiles and executes correctly in objfpc mode (and rejected by Delphi and by FPC in > mode Delphi). Is implicit taking address of array there by design? Yes, it is a FPC feature which is widely used by Lazarus.

This is good to know, thanks!

Sergei

Reply by email