Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #88640
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: About Flibble |
| Date | 2023-01-19 12:16 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <tqc8ff$1m9u0$3@dont-email.me> (permalink) |
| References | (10 earlier) <tq9itk$11c14$1@dont-email.me> <TdYxL.55143$cKvc.26719@fx42.iad> <tq9jor$11aca$2@dont-email.me> <tq9k4g$11j7f$3@dont-email.me> <87h6wnju8f.fsf@nosuchdomain.example.com> |
On 1/18/2023 3:30 PM, Keith Thompson wrote: > David Brown <david.brown@hesbynett.no> writes: >> On 18/01/2023 21:11, Chris M. Thomasson wrote: >>> On 1/18/2023 12:00 PM, Scott Lurndal wrote: >> >>>> Or using uninitialized variables, particularly in >>>> functions. Could work for weeks, then the program >>>> takes a different path and the stack contains a >>>> value that causes a crash. >>> True. Well, so far, I don't think I have a problem. MSVC is pretty >>> good at flagging uninitialized variables, and I have a habit of >>> always initializing them. >>> int x = 0; >>> instead of: >>> int x; >> >> That's a /really/ bad idea (unless you actually /want/ x to be 0, of >> course). It is bad precisely because it stops the compiler from >> warning you when you have forgotten to put a real value in the >> variable. >> >> Get in the habit of declaring local variables only when you have >> something useful to put in them, and initialising them at that point. >> But if you must declare a variable before you have an initial value, >> do not artificially initialise it - you are just making it harder for >> the tools to find your bugs. > > Or initialize it with some recognizably invalid value, if there is such > a value for the type. 0xDEADBEEF is a fun one. :^) > > Leaving it uninitialized helps the compiler diagnose errors. > Initializing it with recognizable garbage helps with run-time debugging. >
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
About Flibble Mr Flibble <flibble@reddwarf.jmc.corp> - 2023-01-02 01:22 +0000
Re: About Flibble "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-01-02 18:39 +0100
Re: About Flibble Mr Flibble <flibble@reddwarf.jmc.corp> - 2023-01-02 18:08 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-02 21:41 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-02 21:43 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-02 21:44 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-04 00:59 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-11 23:13 -0800
Re: About Flibble Stuart Redmann <DerTopper@web.de> - 2023-01-13 07:19 +0100
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-13 10:15 +0000
Re: About Flibble Manu Raju <MR@invalid.invalid> - 2023-01-13 14:29 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-13 13:43 -0800
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-14 09:52 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-14 14:44 -0800
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-16 11:37 +0100
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-16 11:45 -0800
Re: About Flibble Mr Flibble <flibble@reddwarf.jmc.corp> - 2023-01-16 20:49 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 00:02 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 00:04 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-16 11:52 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-16 11:57 -0800
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-16 11:32 +0100
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-16 11:31 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-16 11:51 -0800
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-17 09:34 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-17 12:36 -0800
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-18 09:27 +0000
Re: About Flibble Christian Gollwitzer <auriocus@gmx.de> - 2023-01-18 16:22 +0100
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 11:56 -0800
Re: About Flibble scott@slp53.sl.home (Scott Lurndal) - 2023-01-18 20:00 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 12:11 -0800
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-18 21:17 +0100
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 12:35 -0800
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-19 08:55 +0100
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-23 20:11 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-23 20:12 -0800
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 12:37 -0800
Re: About Flibble Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-01-18 15:30 -0800
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-19 08:55 +0100
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-19 12:16 -0800
Re: About Flibble Muttley@dastardlyhq.com - 2023-01-19 09:33 +0000
Re: About Flibble David Brown <david.brown@hesbynett.no> - 2023-01-19 15:28 +0100
Re: About Flibble scott@slp53.sl.home (Scott Lurndal) - 2023-01-19 14:57 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-16 11:46 -0800
Re: About Flibble Mr Flibble <flibble@reddwarf.jmc.corp> - 2023-01-14 19:24 +0000
Re: About Flibble Mr Flibble <flibble@reddwarf.jmc.corp> - 2023-01-14 19:24 +0000
Re: About Flibble "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-14 13:13 -0800
csiph-web