View previous topic :: View next topic |
Author |
Message |
fwend
Joined: 02 Jun 2006 Posts: 2
|
Posted: Fri Jun 02, 2006 10:57 am Post subject: small error in FileInputExample |
|
|
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 |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Fri Jun 02, 2006 12:10 pm Post subject: Re: small error in FileInputExample |
|
|
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 |
|
|
fwend
Joined: 02 Jun 2006 Posts: 2
|
Posted: Fri Jun 02, 2006 2:48 pm Post subject: |
|
|
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 |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 05, 2006 8:45 am Post subject: |
|
|
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 |
|
|
|