Article View: news.software.readers
Article #260026Re: How could defining a variable, and not using it, be a problem ?
From: Peter Köhlmann
Date: Mon, 28 Mar 2016 22:25
Date: Mon, 28 Mar 2016 22:25
28 lines
2842 bytes
2842 bytes
wrote: > PeterKöhlmann wrote: >> > Disabling certain warnings is best, I've found. >> > Sometimes I want unreferenced variables, for example, just because. >> > I'm using my code, so I know that it works the way I want. >> >> using "unreferenced variables" is a way for disaster, >> and every programmer better than DumbFullSnit should know that > > How could defining a variable, and not using it, be a problem ? It is because the warnings cloak other warnings. And why on earth would someone with more than 2 braincells define variables only to never use them? And worse: it can mean that you in reality meant to use the unreferenced variable, but did not and used instead another one, which may lead to faulty/unexpected behaviour. It can also occur because some part of the code has been rewritten and the variable is "no longer" used. In that case it should be removed Masking that compiler warning will even deprave you of that knowledge, which can lead to difficult error searches. After all, the code compiles and runs. Just maybe not like you intended. It is *never* a good idea to use unreferenced variables, and I remove them always instead of masking the warning
Technical Details
Message-ID:
<ndcaqc$684$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.os.linux.advocacy.(1483839).mbox.7z!not-for-mailReferences:
<3382742e-7219-4aa1-93cd-d43a78cb6760@googlegroups.com> <Jeff-Relf.Me@Mar.27{9.21A.Seattle.2016}> <nd9ru3$751$1@dont-email.me> <ng9ifb57orabua1vr6grldtg8k6m91djvq@4ax.com> <Jeff-Relf.Me@Mar.28{6.17A.Seattle.2016}> <ndc87p$nuh$2@dont-email.me> <Jeff-Relf.Me@Mar.28{2.52P.Seattle.2016}>Show Full Headers
Complete Article Headers
Message-ID: <ndcaqc$684$1@dont-email.me>
Subject: Re: How could defining a variable, and not using it, be a problem ?
Date: Tue, 29 Mar 2016 00:25:17 +0200
From: Peter Köhlmann <peter-koehlmann@t-online.de>
References: <3382742e-7219-4aa1-93cd-d43a78cb6760@googlegroups.com> <Jeff-Relf.Me@Mar.27{9.21A.Seattle.2016}> <nd9ru3$751$1@dont-email.me> <ng9ifb57orabua1vr6grldtg8k6m91djvq@4ax.com> <Jeff-Relf.Me@Mar.28{6.17A.Seattle.2016}> <ndc87p$nuh$2@dont-email.me> <Jeff-Relf.Me@Mar.28{2.52P.Seattle.2016}>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.os.linux.advocacy.(1483839).mbox.7z!not-for-mail
Newsgroups: comp.os.linux.advocacy,sci.physics,alt.free.newsservers,news.software.readers
Organization: DNLA GmbH
Lines: 27
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8Bit
Injection-Date: Mon, 28 Mar 2016 22:22:04 -0000 (UTC)
Injection-Info: mx02.eternal-september.org; posting-host="0f6954be5793e8e857583fced3df3065";
logging-data="6404"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TyK9lNU+9mHXykok7amJgmUKilPB8KZE="
X-Face: $<~KY{nMrt|(0EivP4`4l9HfN=V-jo;V;$-xaClll+F]>NsUH~FJT?]u)!Y)Yz13M]gU$wLlA[tU-"OoeG#|3Q~X/dureXwbUTt!tB|74IDO[%ZI:)|nzC9a^Ut\Z`aR5tBEbImzK=Y^Ds(T]|%=-tklf*G5<=IEVL`f7-V5G0@M)@."$]Ao8$'fRAuR-+JwY@%Ibm#cJBYmRZ6-_\2Tn~,h5$/3dd|[[Qp+EW=rAp"1"bEL1Cvx*'?Fq\{^+trE;2gLfTgYBIG2tID#~OD>U
Cancel-Lock: sha1:D6dNzJb168xgjnFTj6hKoStvsQY=
X-Received-Body-CRC: 3501462643
X-Received-Bytes: 2820