BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

No compiler warning?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General)
View previous topic :: View next topic  
Author Message
Bill Allaire
Guest





PostPosted: Thu Jun 16, 2005 2:26 pm    Post subject: No compiler warning? Reply with quote



I expected to get a hint/warning from the compiler but I didn't. Can
someone explain why I didn't receive one for the commented line of code?
The code is a careless mistake on my part but something the compiler
should catch, right?



unit test;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function printLane(const lane: integer): string; overload;
function printLane(const lane: string): string; overload;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.printLane(const lane: integer): string;
begin
result := '3';
end;

function TForm1.printLane(const lane: string): string;
begin
// Here I thought I would be warned by the compiler
// about a lack of assigned to the functions return value
// (result or function name is not assigned any value)
printLane(StrToInt(lane));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
printLane(3);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(printLane('9'));
end;

end.
Back to top
Riki Wiki
Guest





PostPosted: Mon Jun 20, 2005 5:48 pm    Post subject: Re: No compiler warning? Reply with quote



On Thu, 16 Jun 2005 10:26:32 -0400, Bill Allaire wrote:

Quote:
I expected to get a hint/warning from the compiler but I didn't. Can
someone explain why I didn't receive one for the commented line of code?
The code is a careless mistake on my part but something the compiler
should catch, right?

Hello Bill

Take a look here:
http://delphi.wikicities.com/wiki/Delphi_Newsgroups

Back to top
helloworld@500mghosting.c
Guest





PostPosted: Wed Jun 22, 2005 7:43 am    Post subject: Re: No compiler warning? Reply with quote



Quote:
Take a look here:
[url]http://delphi.wikicities.com/w­iki/Delphi_Newsgroups[/url]

That's supposed to explain why it doesn't give a warning ?


Back to top
Riki Wiki
Guest





PostPosted: Tue Jun 28, 2005 7:36 pm    Post subject: Re: No compiler warning? Reply with quote

On 22 Jun 2005 00:43:27 -0700, [email]helloworld (AT) 500mghosting (DOT) com[/email] wrote:

Quote:
Take a look here:
[url]http://delphi.wikicities.com/w­iki/Delphi_Newsgroups[/url]

That's supposed to explain why it doesn't give a warning ?

Hello HelloWorld

No, it is to explain where to post if you want people to see your question.
Take a look again on
http://delphi.wikicities.com/wiki/Delphi_Newsgroups
especially at the section "Closed or Non-existant Newsgroups".

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.