Article View: comp.unix.programmer
Article #3527Re: Should C/C++ compilers be smart enough to catch this???
From: Eric Sosman
Date: Thu, 03 Apr 2003 22:48
Date: Thu, 03 Apr 2003 22:48
20 lines
2135 bytes
2135 bytes
Fred Ma wrote:
>
> Thanks for the tip about -Wall. I never realized I had so much
> problem with my code until I turned it on. I thought I was being
> high and mighty righteous-like with -pedantic, but it looks like
> there is a higher righteousness. Lots of good reading, too, of
> the man page.
Try using both -W and -Wall; the latter's name suggests
that it's enabling "all" warnings, but that's not so.
Also, -O2 (or higher) in conjunction with these can
produce warnings that will help locate uses of uninitialized
variables.
For code that can tolerate it (some perfectly good code
cannot), consider adding -ansi.
--
Eric.Sosman@sun.com
Technical Details
Message-ID:
<3E8CBA21.3BC2B23F@sun.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!out.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!wn14feed!worldnet.att.net!4.24.21.153!chcgil2-snh1.gtei.net!crtntx1-snh1.gtei.net!atlnga1-snf1.ops.genuity.net!news.gtei.net!cltea-news-1.sun.com!news1brm.central.sun.com!not-for-mailReferences:
<3E8C8C4F.ABC60B0F@doe.carleton.ca> <yw1x65pvfflm.fsf@zaphod.guide> <3E8CB293.44FCA73@doe.carleton.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,2ca0bb2ef0ae6ada X-Google-Attributes: gid11318c,public X-Google-Thread: fc89c,2ca0bb2ef0ae6ada X-Google-Attributes: gidfc89c,public X-Google-ArrivalTime: 2003-04-03 14:52:14 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!out.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!wn14feed!worldnet.att.net!4.24.21.153!chcgil2-snh1.gtei.net!crtntx1-snh1.gtei.net!atlnga1-snf1.ops.genuity.net!news.gtei.net!cltea-news-1.sun.com!news1brm.central.sun.com!not-for-mail From: Eric Sosman <Eric.Sosman@sun.com> Newsgroups: comp.unix.programmer,gnu.gcc.help Subject: Re: Should C/C++ compilers be smart enough to catch this??? Date: Thu, 03 Apr 2003 17:48:01 -0500 Organization: Sun Microsystems Lines: 20 Message-ID: <3E8CBA21.3BC2B23F@sun.com> References: <3E8C8C4F.ABC60B0F@doe.carleton.ca> <yw1x65pvfflm.fsf@zaphod.guide> <3E8CB293.44FCA73@doe.carleton.ca> NNTP-Posting-Host: tardis.east.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news1brm.Central.Sun.COM 1049410082 7071 129.148.168.113 (3 Apr 2003 22:48:02 GMT) X-Complaints-To: usenet@news1brm.central.sun.com NNTP-Posting-Date: Thu, 3 Apr 2003 22:48:02 +0000 (UTC) X-Mailer: Mozilla 4.7 [en] (X11; I; SunOS 5.8 sun4u) X-Accept-Language: en