X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3CA5A54B.F4E8DC27@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: g++ Warnings References: <2561-Sat30Mar2002112257+0300-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 30 Date: Sat, 30 Mar 2002 11:53:11 GMT NNTP-Posting-Host: 12.90.167.208 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1017489191 12.90.167.208 (Sat, 30 Mar 2002 11:53:11 GMT) NNTP-Posting-Date: Sat, 30 Mar 2002 11:53:11 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > From: Dong Soo Kim > > Newsgroups: comp.os.msdos.djgpp > > Date: Sat, 30 Mar 2002 09:28:45 +1100 > > > > I was just reading Stroustrup's book on C++ (3rd ed) and in it he says > > that "int x=x;" should produce a warning in good compilers. > > > > Then to my surprise I found that g++ doesn't (both in MingW and Djgpp), > > and silently ignores it. > > It would be a very Bad Idea (tm) for GCC to flag those cases, since > they are widely used to shut up compiler warnings about variables > which the compiler things are used before they are initialized. > (Compilers can err about this because they don't understand what > range of values can certain variables have, and thus don't know what > conditions could fire under what circumstances.) I find it is quite easy to slightly recast the routines just to make things 'perfectly clear' to the compiler. That way the warning will come up if I make some foolish future revisions. If I can't do this the code was overly complex to begin with. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net) Available for consulting/temporary embedded and systems. (Remove "XXXX" from reply address. yahoo works unmodified) mailto:uce AT ftc DOT gov (for spambots to harvest)