Sign in Join

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

Mailing lists / fpc-pascal / 2002-01

forward declaration of classes

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

Hi all,

If I forward define a class, e.g. 'TMyForwardClass = class;', in the interface section and put the real definition in the implementation section, the compiler gives a

test1.pas(144) Warning: test1.ppu Interface CRC changed 17185289292054119697

but it compiles.
I'm not sure if this is wanted. Definitions in the implementation section should not be visible, but this way I could use the class internals of TMyForwardClass in an another unit, as if the class is defined completely in the interface section.

What is the bug and what should be the right behaviour?

I think, bug 1599 is something similar.

Mattias Gaertner

Peter Vreman
Hi all, If I forward define a class, e.g. 'TMyForwardClass = class;', in the interface section

and
put the real definition in the implementation section, the compiler gives a

Show quoted text 5 lines
test1.pas(144) Warning: test1.ppu Interface CRC changed 17185289292054119697 but it compiles. I'm not sure if this is wanted. Definitions in the implementation section should not be

visible, but this way I could use the class internals of TMyForwardClass in an another unit, as if the class is defined completely in the interface section.

What is the bug and what should be the right behaviour? I think, bug 1599 is something similar.

I guess it's a bug, but what does Delphi give?

Mattias Gaertner
to Peter Vreman
GMT Peter Vreman wrote 18 lines
> Hi all, > > If I forward define a class, e.g. 'TMyForwardClass = class;', in the interface section and put the real definition in the implementation section, the compiler gives a > > test1.pas(144) Warning: test1.ppu Interface CRC changed 17185289292054119697 > > but it compiles. > I'm not sure if this is wanted. Definitions in the implementation section should not be visible, but this way I could use the class internals of TMyForwardClass in an another unit, as if the class is defined completely in the interface section. > > What is the bug and what should be the right behaviour? > > I think, bug 1599 is something similar. I guess it's a bug, but what does Delphi give?

Test1.pas(9): Type 'TMyForwardClass' is not yet completely defined

Mattias

Peter Vreman
Show quoted text 6 lines
On Thu, 17 Jan 2002 15:28:41 GMT Peter Vreman wrote: > > Hi all, > > > > If I forward define a class, e.g. 'TMyForwardClass = class;', in the interface

section

Show quoted text 7 lines
> and > put the real definition in the implementation section, the compiler gives a > > > > test1.pas(144) Warning: test1.ppu Interface CRC changed 17185289292054119697 > > > > but it compiles. > > I'm not sure if this is wanted. Definitions in the implementation section should not

be

Show quoted text 10 lines
> visible, but this way I could use the class internals of TMyForwardClass in an another > unit, as if the class is defined completely in the interface section. > > > > What is the bug and what should be the right behaviour? > > > > I think, bug 1599 is something similar. > > I guess it's a bug, but what does Delphi give? Test1.pas(9): Type 'TMyForwardClass' is not yet completely defined

Then it's for sure a bug ;)