Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #88617
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: About Flibble |
| Date | Wed, 18 Jan 2023 15:30:56 -0800 |
| Organization | None to speak of |
| Lines | 36 |
| Message-ID | <87h6wnju8f.fsf@nosuchdomain.example.com> (permalink) |
| References | <17365954d3a22919$8654$16855$7aa12caf@news.newsdemon.com> <tpobu9$176tp$1@dont-email.me> <289481310.695283021.465635.DerTopper-web.de@news.eternal-september.org> <tpsj9b$1n8oj$1@dont-email.me> <tq3942$2mhn0$2@dont-email.me> <tq3cic$1p9$1@gioia.aioe.org> <tq49ss$2rp5t$3@dont-email.me> <tq5q3h$2f3$1@gioia.aioe.org> <tq70rm$3cmni$1@dont-email.me> <tq8e1h$fhr$1@gioia.aioe.org> <tq9itk$11c14$1@dont-email.me> <TdYxL.55143$cKvc.26719@fx42.iad> <tq9jor$11aca$2@dont-email.me> <tq9k4g$11j7f$3@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | reader01.eternal-september.org; posting-host="b54a4200828c7751654ce581a3c30a90"; logging-data="1165133"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ExhBAZbZTns9PCQ02Go4i" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
| Cancel-Lock | sha1:ohL5NmsghpH6J+3+wyJY6difTsE= sha1:qlyBT5mt8f/TrH1q2yYJVXCNrXU= |
| Xref | csiph.com comp.lang.c++:88617 |
Show key headers only | View raw
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.
Leaving it uninitialized helps the compiler diagnose errors.
Initializing it with recognizable garbage helps with run-time debugging.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
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