Wish: Variable Not Used Warning

JAnderson ask at me.com
Tue Jul 29 07:52:58 PDT 2008


BCS wrote:
> Reply to Markus,
> 
>> On Thu, 10 Jul 2008 12:51:47 -0700, Walter Bright wrote:
>>
>>> Robert Fraser wrote:
>>>
>>>> In a final release, unused things are signs of errors. When writing
>>>> code, unused variables (perhaps they were used in a commented-out
>>>> section?) are a dime a dozen.
>>>>
>>> Yes, that's why I find the warning to be a nuisance, not a help.
>>>
>> I'd been coding for awhile, and I have hard times to remember the last
>> time I have had unused vars or other pieces of code, that would be
>> there intentionally... Sure, I may have got some sort of brain-damage
>> due to heavy use of "gcc -Wall" and "lint" to affect to my coding
>> style so that I unconsciously avoid warning-generating sketchs...
>>
>> About those unused imports (mentioned by Robert) - I think that the
>> compiler could stop also with those. I was just coming to that subject
>> :D
>>
> 
> one cases where the extra vars might be added is as padding for cache 
> effects.
> 
> 

In C++ this is not really a problem.  There are 2 ways to deal with 
this.  One "var;" and 2 don't give the variable a name.

-Joel



More information about the Digitalmars-d mailing list