Article View: borland.public.delphi.language.objectpascal
Article #145Re: compiler warning "Return value of function 'xxx' might be undefined" wrong
From: Heinrich Wolf
Date: Thu, 11 Mar 2004 17:38
Date: Thu, 11 Mar 2004 17:38
47 lines
2245 bytes
2245 bytes
I am a user, so my information is NOT official.
Look at this simple function:
function Undefined : Boolean;
var b : Boolean;
begin
b := True;
if b then
Undefined := True;
end;
For any programmer it is clear that the function
is not undefined.
But the compiler cannot assure this.
Try initializing like this:
function Undefined : Boolean;
var b : Boolean;
begin
undefined := False;
b := True;
if b then
Undefined := True;
end;
Then check, if your function is still undefined.
"sas" <sschendel@peoplenetonline.com> schrieb im Newsbeitrag
news:79f518f1.0403041151.7b1a93de@posting.google.com...
> Got the following compiler message:
>
> "[Warning] Unit1.pas(46): Return value of function 'TForm1.Test' might
> be undefined"
>
> on a very simple project compiled using delphi 7.
>
> I've read some posts that say there is a limit to the number of local
> variables you can define in a function, and after exceeding that limit
> may
> result in erroneous compiler warnings, like the one I am seeing.
>
> Would like to get an "official" confirmation on this limitation in
> delphi 7 compiler.
>
> If anyone can point me at to a Borland bug report, tech note, etc.,
> describing this, I would appreciate it. Thanks.
Technical Details
Message-ID:
<c2q88h$20h84a$1@ID-223070.news.uni-berlin.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!d58-91.dsl.easysurfnet.DE!not-for-mailReferences:
<79f518f1.0403041151.7b1a93de@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d30,e75231c4c9199fdf X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2004-03-11 09:39:31 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!d58-91.dsl.easysurfnet.DE!not-for-mail From: "Heinrich Wolf" <me@privacy.net> Newsgroups: borland.public.delphi.language.objectpascal Subject: Re: compiler warning "Return value of function 'xxx' might be undefined" wrong Date: Thu, 11 Mar 2004 18:38:54 +0100 Lines: 49 Message-ID: <c2q88h$20h84a$1@ID-223070.news.uni-berlin.de> References: <79f518f1.0403041151.7b1a93de@posting.google.com> NNTP-Posting-Host: d58-91.dsl.easysurfnet.de (83.121.58.91) X-Trace: news.uni-berlin.de 1079026770 67674250 I 83.121.58.91 ([223070]) 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