Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Program to print the longest line |
| Date | 2015-11-18 09:24 -0800 |
| Organization | None to speak of |
| Message-ID | <lnd1v7fcfo.fsf@kst-u.example.com> (permalink) |
| References | <8a605c3e-2e2d-456f-bcf4-f23bf4c40bc2@googlegroups.com> <lna8qbgsmr.fsf@kst-u.example.com> <17df1fa8-6093-4ea6-8c69-6bfaf27aa73b@googlegroups.com> |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Wednesday, November 18, 2015 at 4:49:24 PM UTC, Keith Thompson wrote:
[...]
>> That's very close to being correct.
>>
>> The array is not *empty*. Each of its elements has a value from the
>> moment the array is created. In the absence of any initialization, that
>> value just happens to be garbage. A 1000-element array of char always
>> holds 1000 char values.
>>
> C programmers misuse the term "array".
No, most of us don't, but you do.
[...]
> But in C we don't make much of a distinction between memory with garbage
> in it and memory with data.
Correct. For example,
int n;
defines an object `n` of type int. It is an int object whether a value
has been stored in it or not. Exactly the same thing applies to objects
of array type.
> So int square[10][10]; creates 100
> integers, initialised to garbage values. It actually an error to try
> to read them, but few compilers enforce that.
To be precise, it's undefined behavior.
> If you set the values to 1 .. 100 then of course you have an
> array. Now the values mean something.
You are introducing needless confusion. If you want to talk about
initialized array objects vs. uninitialized array objects, either use
those terms (preferable) or invent your own. Pretending that an
uninitialized array object is not an "array" is not useful, and I
suggest you stop spouting such nonsense in the presence of novice C
programmers.
(If you can cite a reliable source that says an array object isn't an
"array" until it's been initialized, I'd be interested in seeing it --
but it still wouldn't affect the correct terminology used when
discussing C.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 08:10 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-18 08:49 -0800
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 09:03 -0800
Re: Program to print the longest line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-18 09:04 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-18 09:24 -0800
Re: Program to print the longest line Richard Heathfield <rjh@cpax.org.uk> - 2015-11-18 17:42 +0000
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 10:49 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-18 13:55 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 11:01 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-18 14:19 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 21:50 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-19 06:39 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-19 05:07 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-19 10:12 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-19 07:49 -0800
Re: Program to print the longest line Richard Heathfield <rjh@cpax.org.uk> - 2015-11-18 19:08 +0000
Re: Program to print the longest line Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-18 14:54 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 23:36 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-19 21:15 -0800
Re: Program to print the longest line Geoff <geoff@invalid.invalid> - 2015-11-19 21:29 -0800
Re: Program to print the longest line David Brown <david.brown@hesbynett.no> - 2015-11-20 11:00 +0100
Re: Program to print the longest line glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-20 15:13 +0000
Re: Program to print the longest line supercat@casperkitty.com - 2015-11-20 11:29 -0800
Re: Program to print the longest line Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-20 12:51 -0800
Re: Program to print the longest line Philip Lantz <prl@canterey.us> - 2015-11-24 01:59 -0800
Re: Program to print the longest line Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-27 13:34 -0800
Re: Program to print the longest line John Gordon <gordon@panix.com> - 2015-11-18 18:10 +0000
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 10:53 -0800
Re: Program to print the longest line Barry Schwarz <schwarzb@dqel.com> - 2015-11-18 13:55 -0800
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 23:32 -0800
Re: Program to print the longest line Barry Schwarz <schwarzb@dqel.com> - 2015-11-18 11:58 -0800
csiph-web