Sign in Join

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

Mailing lists / fpc-devel / 2014-05

test on TP

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Marco van de Voort

Can sb test this program on TP/BP7 and tell me the result? Thank you.

program sometest;
{$ifdef fpc}
{$mode tp}
{$endiof}
Type
   PChildThing = ^TChildThing;
   TChildThing = object
		    constructor init;
                  end;
   PSomething = ^TSomething;
   TSomething = object
                    ct:PChildThing;
		    constructor init;
                  end;
constructor TSomething.init;
begin
   new(ct,init);
end;
var p : PSomething;
constructor TChildThing.Init;
begin
  if assigned(p) then
    writeln('assigned')
  else
    writeln('not assigned')
end;
begin
  p:=nil;
  p:=new(PSomething,Init);
end.

Reply by email

Gerhard Scholz
to Marco van de Voort

BP 7.0 (real)
BP7.0 (protected)
VP2.1b279

all: "not assigned"

Earlier message 52 lines
----- Original Message ----- From: "Marco van de Voort" To: Sent: Wednesday, May 14, 2014 11:46 AM Subject: [fpc-devel] test on TP > > Can sb test this program on TP/BP7 and tell me the result? Thank you. > > program sometest; > > {$ifdef fpc} > {$mode tp} > {$endiof} > > Type > PChildThing = ^TChildThing; > TChildThing = object > constructor init; > end; > > PSomething = ^TSomething; > TSomething = object > ct:PChildThing; > constructor init; > end; > > > constructor TSomething.init; > > begin > new(ct,init); > end; > > var p : PSomething; > > constructor TChildThing.Init; > begin > if assigned(p) then > writeln('assigned') > else > writeln('not assigned') > end; > > begin > p:=nil; > p:=new(PSomething,Init); > end. > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Tomas Hajny
to Gerhard Scholz
Gerhard Scholz wrote 5 lines
BP 7.0 (real) BP7.0 (protected) VP2.1b279 all: "not assigned"

Indeed (apart from the obvious typo "endiof" preventing compilation, of course). Why / how could it give a different result?

Tomas

Show quoted text 49 lines
----- Original Message ----- From: "Marco van de Voort" To: Sent: Wednesday, May 14, 2014 11:46 AM Subject: [fpc-devel] test on TP > > Can sb test this program on TP/BP7 and tell me the result? Thank you. > > program sometest; > > {$ifdef fpc} > {$mode tp} > {$endiof} > > Type > PChildThing = ^TChildThing; > TChildThing = object > constructor init; > end; > > PSomething = ^TSomething; > TSomething = object > ct:PChildThing; > constructor init; > end; > > > constructor TSomething.init; > > begin > new(ct,init); > end; > > var p : PSomething; > > constructor TChildThing.Init; > begin > if assigned(p) then > writeln('assigned') > else > writeln('not assigned') > end; > > begin > p:=nil; > p:=new(PSomething,Init); > end.

Reply by email

Marco van de Voort
to Tomas Hajny

In our previous episode, Tomas Hajny said:

Indeed (apart from the obvious typo "endiof" preventing compilation, of course). Why / how could it give a different result?

I'm hunting down a problem with the TV form editor. (you replied in the thread on the forum). The problem had this rough structure, but it could be this, or that the order of events fired is different. (IOW FV fires certain events from the constructor and TV not).

The latter is harder to debug, so I wanted to make sure it wasn't some language difference.

Reply by email

Jonas Maebe
to Marco van de Voort
Marco van de Voort wrote 8 lines
In our previous episode, Tomas Hajny said: > Indeed (apart from the obvious typo "endiof" preventing compilation, of > course). Why / how could it give a different result? I'm hunting down a problem with the TV form editor. (you replied in the thread on the forum). The problem had this rough structure, but it could be this, or that the order of events fired is different. (IOW FV fires certain events from the constructor and TV not).

You may have forgotten to put something in your test code in that case, because you don't assign anything to "p" anywhere.

Jonas

Reply by email

Marco van de Voort
to Jonas Maebe

In our previous episode, Jonas Maebe said:

Show quoted text 6 lines
> I'm hunting down a problem with the TV form editor. (you replied in the > thread on the forum). The problem had this rough structure, but it could be > this, or that the order of events fired is different. (IOW FV fires certain > events from the constructor and TV not). You may have forgotten to put something in your test code in that case, because you don't assign anything to "p" anywhere.

I think not. I really wanted to check that the result of the allocation wasn't stored to p before the constructor ran.

Reply by email