 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bill Allaire Guest
|
Posted: Thu Jun 16, 2005 2:26 pm Post subject: No compiler warning? |
|
|
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
|
Posted: Mon Jun 20, 2005 5:48 pm Post subject: Re: No compiler warning? |
|
|
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
|
Posted: Wed Jun 22, 2005 7:43 am Post subject: Re: No compiler warning? |
|
|
| Quote: | Take a look here:
[url]http://delphi.wikicities.com/wiki/Delphi_Newsgroups[/url]
|
That's supposed to explain why it doesn't give a warning ?
|
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Tue Jun 28, 2005 7:36 pm Post subject: Re: No compiler warning? |
|
|
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/wiki/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 |
|
 |
|
|
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
|
|