🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #32463

Compile

#32463
From: RB
Date: Sat, 23 Nov 2002 16:04
96 lines
2730 bytes
Is this a bug, or do I misunderstand something.

In the helpfile for Compile, it says:

"If the interface part of a unit has changed, all the other units
 that depend on the changed unit are recompiled."

But then look at the project below.

(1)  Save,build and run it. (No problems).

(2) In unitA, change the two occurences of "out" to "var".

(3). Save, compile(CTRL-F9) and run it. (It does compile and run!)

(4). Build the project. Now the expected syntax error is repored:
          [Error] UnitB.pas(12): Declaration of 'Proc' differs from previous
declaration

In believed that  in (3) the compiler should have noted, that the interface
part of
unitA has changed, hence it should have recompiled unitB, and then
reported the syntax error.

This is a very reduced example. In the original program
step (3) produced apparently correct results, but gave memory leaks.
Also the type of  "a"  was not Integer, but a RefCounted interface-type.

RB

------------------------------------------------
program VarOut;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  UnitA in 'UnitA.pas',
  UnitB in 'UnitB.pas';

var
  a : TObjectA;
  h : Integer;
begin
  a:=TObjectB.Create;
  a.Proc(h);
  a.Free;
  Readln;
end.
-----------------------------------------------------
unit UnitA;

interface

type

TObjectA = class
  procedure Proc(out a:Integer); virtual;
end;

implementation

procedure TObjectA.Proc(out a:Integer);
begin
  Writeln('A');
  a:=0;
end;

end.
----------------------------------------------------
unit UnitB;

interface

uses

UnitA;

type

TObjectB = class(TObjectA)
  procedure Proc(out a:Integer); override;
end;

implementation

procedure TObjectB.Proc(out a:Integer);
begin
  Writeln('B');
  a:=0;
end;

end.
----------------------------------------------------

RB
Technical Details
Message-ID: <3ddfa6f2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,3a91406f458ba997,start
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2002-11-23 08:16:05 PST
From: "RB" <rene.NO.de.SPAM.blanck@tdcadsl.WANTED.dk>
Newsgroups: borland.public.delphi.language.objectpascal
Subject: Compile
Date: Sat, 23 Nov 2002 17:04:03 +0100
Lines: 98
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 80.63.187.171
Message-ID: <3ddfa6f2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038067442 80.63.187.171 (23 Nov 2002 08:04:02 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail