FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

small error in FileInputExample

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
fwend



Joined: 02 Jun 2006
Posts: 2

PostPosted: Fri Jun 02, 2006 10:57 am    Post subject: small error in FileInputExample Reply with quote

There's a small error I noticed in the FileInputExample at http://www.dsource.org/projects/tutorials/wiki/FileInputExample

char[] fn is never used

I though it was an error when a local variable is never used. Compiles just fine though.

Now that I've registered for the forum I can also edit the wiki, didn't realize that. So I changed it.
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Jun 02, 2006 12:10 pm    Post subject: Re: small error in FileInputExample Reply with quote

fwend wrote:
There's a small error I noticed in the FileInputExample at http://www.dsource.org/projects/tutorials/wiki/FileInputExample

char[] fn is never used

I though it was an error when a local variable is never used (or when any other type of variable isn't used). Compiles just fine though.
It's not a compilation error when a variable isn't used. And I'm glad it isn't because sometime I come up variables that I'm not using when I'm trying to debug or refactor. It wouldn't hurt to have a lint-type program to alert me that I'm not using a variable, but it doesn't usually cause a problem for me if I have extra variables that aren't being used. I remove them if I find them, but I don't spend a lot of time trying to weed them out.

fwend wrote:
Now that I've registered for the forum I can also edit the wiki, didn't realize that. So I changed it.
Thanks for fixing it.
Back to top
View user's profile Send private message AIM Address
fwend



Joined: 02 Jun 2006
Posts: 2

PostPosted: Fri Jun 02, 2006 2:48 pm    Post subject: Reply with quote

I was referring to the following statement:

It is an error to declare a local variable that is never referred to. Dead variables, like anachronistic dead code, is just a source of confusion for maintenance programmers.

http://www.digitalmars.com/d/function.html
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Mon Jun 05, 2006 8:45 am    Post subject: Reply with quote

fwend wrote:
I was referring to the following statement:

It is an error to declare a local variable that is never referred to. Dead variables, like anachronistic dead code, is just a source of confusion for maintenance programmers.

http://www.digitalmars.com/d/function.html
Thanks for the citation. I didn't remember that being there. I suspect it's mistake in the documentation because I don't remember the compiler ever complaining about leaving a variable unused.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
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, 2005 phpBB Group