Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #140498 > unrolled thread

Re: Didactic "white lies"

Started byKeith Thompson <kst-u@mib.org>
First post2019-02-03 12:46 -0800
Last post2019-02-05 08:55 -0800
Articles 13 — 7 participants

Back to article view | Back to comp.lang.c

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Didactic "white lies" Keith Thompson <kst-u@mib.org> - 2019-02-03 12:46 -0800
    Re: Didactic "white lies" "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-02-03 23:40 +0100
    Re: Didactic "white lies" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-02-04 03:35 -0800
      Re: Didactic "white lies" Keith Thompson <kst-u@mib.org> - 2019-02-04 12:01 -0800
      Re: Didactic "white lies" James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-02-04 12:33 -0800
        Re: Didactic "white lies" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-02-05 01:37 -0800
          Re: Didactic "white lies" Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-02-05 08:56 -0700
            Re: Didactic "white lies" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-02-05 08:03 -0800
              Re: Didactic "white lies" scott@slp53.sl.home (Scott Lurndal) - 2019-02-05 16:39 +0000
              Re: Didactic "white lies" James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-02-05 10:35 -0800
                Re: Didactic "white lies" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-02-05 12:34 -0800
          Re: Didactic "white lies" James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-02-05 10:31 -0800
      Re: Didactic "white lies" John Bode <jfbode1029@gmail.com> - 2019-02-05 08:55 -0800

#140498 — Re: Didactic "white lies"

FromKeith Thompson <kst-u@mib.org>
Date2019-02-03 12:46 -0800
SubjectRe: Didactic "white lies"
Message-ID<lnsgx4vbuu.fsf@kst-u.example.com>
ram@zedat.fu-berlin.de (Stefan Ram) writes:
>   One white lie I tell at the beginning of my C course, when
>   the proper treatment of pointers still is in a remote distance:
>
>   To explain »char *«: »char« means "character", and the »*«
>   means the preceding thing can be repeated arbitrarily often,
>   so »char *« means "a sequence of characters". - Explanation 
>   without the need to speak of anything that was not treated yet.
>
>   The truth in that lie is: When you follow a »char *« you 
>   are usually supposed to find any number of character
>   objects there. (Though I'm not sure what to make of the
>   special case of 0 characters. Well, we can »malloc(0)«,
>   so why not?)

By telling this "white" lie, you help perpetuate the confusion about
the relationship between arrays and pointers in C.  I've had to
(well, I've chosen to) spend way too much time clearing up this
confusion, usually with a reference to section 6 of the comp.lang.c
FAQ.

If you don't want to explain pointers yet, you can show some examples
of pointer syntax and say that the details will be explained later.
(And I'll bet some of your students will want to find out how
pointers really mean before the course gets to it.)

At what point in the course can your students safely assume that
you're no longer lying to them?

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [next] | [standalone]


#140504

From"Pascal J. Bourguignon" <pjb@informatimago.com>
Date2019-02-03 23:40 +0100
Message-ID<m2va20qywh.fsf@despina.home>
In reply to#140498
Keith Thompson <kst-u@mib.org> writes:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>   One white lie I tell at the beginning of my C course, when
>>   the proper treatment of pointers still is in a remote distance:
>>
>>   To explain »char *«: »char« means "character", and the »*«
>>   means the preceding thing can be repeated arbitrarily often,
>>   so »char *« means "a sequence of characters". - Explanation 
>>   without the need to speak of anything that was not treated yet.
>>
>>   The truth in that lie is: When you follow a »char *« you 
>>   are usually supposed to find any number of character
>>   objects there. (Though I'm not sure what to make of the
>>   special case of 0 characters. Well, we can »malloc(0)«,
>>   so why not?)
>
> By telling this "white" lie, you help perpetuate the confusion about
> the relationship between arrays and pointers in C.  I've had to
> (well, I've chosen to) spend way too much time clearing up this
> confusion, usually with a reference to section 6 of the comp.lang.c
> FAQ.
>
> If you don't want to explain pointers yet, you can show some examples
> of pointer syntax and say that the details will be explained later.
> (And I'll bet some of your students will want to find out how
> pointers really mean before the course gets to it.)
>
> At what point in the course can your students safely assume that
> you're no longer lying to them?

I'm sorry to say that I never understood the problem.  It's true that I
learned pointers in Pascal.  Perhaps you should teach Pascal as an
introduction to C programming?

-- 
__Pascal J. Bourguignon__
http://www.informatimago.com

[toc] | [prev] | [next] | [standalone]


#140511

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2019-02-04 03:35 -0800
Message-ID<a8beb5cc-925d-4e8a-b074-b115f0c11abe@googlegroups.com>
In reply to#140498
On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
> 
> By telling this "white" lie, you help perpetuate the confusion about
> the relationship between arrays and pointers in C.  I've had to
> (well, I've chosen to) spend way too much time clearing up this
> confusion, usually with a reference to section 6 of the comp.lang.c
> FAQ.
> 
If you never simplify, it's often too hard for most students to understand.
You wouldn't try to teach general relativity on a primary school time
and motion exercise, after all.
> 
> At what point in the course can your students safely assume that
> you're no longer lying to them?
> 
You can't. An example is the experiment that shows that air is about 20%
oxygen. A candle is lit on a boat, over which is place a bell jar,
resting on a tray of water. The oxygen in the sir is used up, and the candle
goes out, and the water level in the bell jar rises.
Except that most of the effect is from the heat of the candle forcing 
expanded air out of the bell jar. The air inside the bell jar then
cools.

[toc] | [prev] | [next] | [standalone]


#140521

FromKeith Thompson <kst-u@mib.org>
Date2019-02-04 12:01 -0800
Message-ID<lno97ruxuv.fsf@kst-u.example.com>
In reply to#140511
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
>> 
>> By telling this "white" lie, you help perpetuate the confusion about
>> the relationship between arrays and pointers in C.  I've had to
>> (well, I've chosen to) spend way too much time clearing up this
>> confusion, usually with a reference to section 6 of the comp.lang.c
>> FAQ.
>> 
> If you never simplify, it's often too hard for most students to understand.
> You wouldn't try to teach general relativity on a primary school time
> and motion exercise, after all.

You can simplify without lying.  You can explicitly gloss over
things that you're not yet ready to explain.  "Don't worry yet
about what this means, we'll get into it later."

>> At what point in the course can your students safely assume that
>> you're no longer lying to them?
>> 
> You can't. An example is the experiment that shows that air is about 20%
> oxygen. A candle is lit on a boat, over which is place a bell jar,
> resting on a tray of water. The oxygen in the sir is used up, and the candle
> goes out, and the water level in the bell jar rises.
> Except that most of the effect is from the heat of the candle forcing 
> expanded air out of the bell jar. The air inside the bell jar then
> cools.

Then that's not a demonsration that air is about 20% oxygen.
Pretending that it is would be instructional malpractice.

Be honest about what it demonstrates and/or find another way to
demonstrate the oxygen content of air.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#140524

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2019-02-04 12:33 -0800
Message-ID<d7f5b6c3-933a-4284-811b-8ed6d30138ab@googlegroups.com>
In reply to#140511
On Monday, February 4, 2019 at 6:35:48 AM UTC-5, Malcolm McLean wrote:
> On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
...
> If you never simplify, it's often too hard for most students to understand.
> You wouldn't try to teach general relativity on a primary school time
> and motion exercise, after all.
> > 
> > At what point in the course can your students safely assume that
> > you're no longer lying to them?
> > 
> You can't. An example is the experiment that shows that air is about 20%
> oxygen. A candle is lit on a boat, over which is place a bell jar,
> resting on a tray of water. The oxygen in the sir is used up, and the candle
> goes out, and the water level in the bell jar rises.
> Except that most of the effect is from the heat of the candle forcing 
> expanded air out of the bell jar. The air inside the bell jar then
> cools.

This experiment?
<http://www.math.harvard.edu/~knill/pedagogy/waterexperiment/>? Read the
explanation carefully - when done properly (and it's quite possible to
do it improperly), the initial water level is high enough that expansion
of the air does not result in any air leaving the bell jar.

If your explanation had been correct, it would have been pointless to
present this experiment and lie about it. That would teach nothing
useful to the students.

Conservation of energy? Newton's laws of mechanics? The behavior of
perfectly rigid objects, perfectly slippery surfaces? The wave theory of
light? The particle theory of electrons? Those all are lies that justify
very reasonable approximations that are of great practical usefulness.
Several of them can only be proven to be lies by using very carefully
designed experiments, and people can delay learning that they are lies
until they've reached a sufficiently advanced level in their studies
that they can understand those complications.
No such purpose would be served by the lie you suggest, if it were in
fact a lie.

[toc] | [prev] | [next] | [standalone]


#140542

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2019-02-05 01:37 -0800
Message-ID<73208996-f6f5-49e2-a907-9e1cfd185923@googlegroups.com>
In reply to#140524
On Monday, 4 February 2019 20:33:35 UTC, James Kuyper  wrote:
> On Monday, February 4, 2019 at 6:35:48 AM UTC-5, Malcolm McLean wrote:
> > On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
> ...
> > If you never simplify, it's often too hard for most students to understand.
> > You wouldn't try to teach general relativity on a primary school time
> > and motion exercise, after all.
> > > 
> > > At what point in the course can your students safely assume that
> > > you're no longer lying to them?
> > > 
> > You can't. An example is the experiment that shows that air is about 20%
> > oxygen. A candle is lit on a boat, over which is place a bell jar,
> > resting on a tray of water. The oxygen in the sir is used up, and the candle
> > goes out, and the water level in the bell jar rises.
> > Except that most of the effect is from the heat of the candle forcing 
> > expanded air out of the bell jar. The air inside the bell jar then
> > cools.
> 
> This experiment?
> <http://www.math.harvard.edu/~knill/pedagogy/waterexperiment/>? Read the
> explanation carefully - when done properly (and it's quite possible to
> do it improperly), the initial water level is high enough that expansion
> of the air does not result in any air leaving the bell jar.
> 

From the website:

Argument: The experiment can be explained by physics alone. During the heating stage, air escapes. Afterwards, the air volume decreases and pulls the water up.

Source of the Error: the argument could work, if indeed the heating of the air would produce enough pressure that some air could leave. In that case, some air would be lost through the water. But one can observe that the water level stays up even if everything has gone back to normal temperature (say 10 minutes). No bubbles can be seen. 

Knill has got it wrong. If the air escapes due to thermal exapansion, it 
won't be replaced when temperature returns to equilibrium. No bubbles can
be seen - OK, but attention is on the burning candle.

[toc] | [prev] | [next] | [standalone]


#140562

FromJoe Pfeiffer <pfeiffer@cs.nmsu.edu>
Date2019-02-05 08:56 -0700
Message-ID<1bmuna44b6.fsf@pfeifferfamily.net>
In reply to#140542
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> On Monday, 4 February 2019 20:33:35 UTC, James Kuyper  wrote:
>> On Monday, February 4, 2019 at 6:35:48 AM UTC-5, Malcolm McLean wrote:
>> > On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
>> ...
>> > If you never simplify, it's often too hard for most students to understand.
>> > You wouldn't try to teach general relativity on a primary school time
>> > and motion exercise, after all.
>> > > 
>> > > At what point in the course can your students safely assume that
>> > > you're no longer lying to them?
>> > > 
>> > You can't. An example is the experiment that shows that air is about 20%
>> > oxygen. A candle is lit on a boat, over which is place a bell jar,
>> > resting on a tray of water. The oxygen in the sir is used up, and the candle
>> > goes out, and the water level in the bell jar rises.
>> > Except that most of the effect is from the heat of the candle forcing 
>> > expanded air out of the bell jar. The air inside the bell jar then
>> > cools.
>> 
>> This experiment?
>> <http://www.math.harvard.edu/~knill/pedagogy/waterexperiment/>? Read the
>> explanation carefully - when done properly (and it's quite possible to
>> do it improperly), the initial water level is high enough that expansion
>> of the air does not result in any air leaving the bell jar.
>> 
>
> From the website:
>
> Argument: The experiment can be explained by physics alone. During the
> heating stage, air escapes. Afterwards, the air volume decreases and
> pulls the water up.
>
> Source of the Error: the argument could work, if indeed the heating of
> the air would produce enough pressure that some air could leave. In
> that case, some air would be lost through the water. But one can
> observe that the water level stays up even if everything has gone back
> to normal temperature (say 10 minutes). No bubbles can be seen.
>
> Knill has got it wrong. If the air escapes due to thermal exapansion, it 
> won't be replaced when temperature returns to equilibrium. No bubbles can
> be seen - OK, but attention is on the burning candle.

It's pretty clear that when he says "no bubbles can be seen" he means
"there are no bubbles", not that the students are just distracted by the
candle.

[toc] | [prev] | [next] | [standalone]


#140564

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2019-02-05 08:03 -0800
Message-ID<e5033b55-ab4b-4249-b474-2af20138b786@googlegroups.com>
In reply to#140562
On Tuesday, 5 February 2019 15:56:38 UTC, Joe Pfeiffer  wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> 
> > On Monday, 4 February 2019 20:33:35 UTC, James Kuyper  wrote:
> >> On Monday, February 4, 2019 at 6:35:48 AM UTC-5, Malcolm McLean wrote:
> >> > On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
> >> ...
> >> > If you never simplify, it's often too hard for most students to understand.
> >> > You wouldn't try to teach general relativity on a primary school time
> >> > and motion exercise, after all.
> >> > > 
> >> > > At what point in the course can your students safely assume that
> >> > > you're no longer lying to them?
> >> > > 
> >> > You can't. An example is the experiment that shows that air is about 20%
> >> > oxygen. A candle is lit on a boat, over which is place a bell jar,
> >> > resting on a tray of water. The oxygen in the sir is used up, and the candle
> >> > goes out, and the water level in the bell jar rises.
> >> > Except that most of the effect is from the heat of the candle forcing 
> >> > expanded air out of the bell jar. The air inside the bell jar then
> >> > cools.
> >> 
> >> This experiment?
> >> <http://www.math.harvard.edu/~knill/pedagogy/waterexperiment/>? Read the
> >> explanation carefully - when done properly (and it's quite possible to
> >> do it improperly), the initial water level is high enough that expansion
> >> of the air does not result in any air leaving the bell jar.
> >> 
> >
> > From the website:
> >
> > Argument: The experiment can be explained by physics alone. During the
> > heating stage, air escapes. Afterwards, the air volume decreases and
> > pulls the water up.
> >
> > Source of the Error: the argument could work, if indeed the heating of
> > the air would produce enough pressure that some air could leave. In
> > that case, some air would be lost through the water. But one can
> > observe that the water level stays up even if everything has gone back
> > to normal temperature (say 10 minutes). No bubbles can be seen.
> >
> > Knill has got it wrong. If the air escapes due to thermal exapansion, it 
> > won't be replaced when temperature returns to equilibrium. No bubbles can
> > be seen - OK, but attention is on the burning candle.
> 
> It's pretty clear that when he says "no bubbles can be seen" he means
> "there are no bubbles", not that the students are just distracted by the
> candle.
>
He hasn't observed any bubbles. One possibility is that there were no bubbles.
Another is that bubbles were present but were not observed because attention
was focused on the candle.
Science is like that.

[toc] | [prev] | [next] | [standalone]


#140565

Fromscott@slp53.sl.home (Scott Lurndal)
Date2019-02-05 16:39 +0000
Message-ID<4%i6E.302072$Q95.257750@fx41.iad>
In reply to#140564
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>On Tuesday, 5 February 2019 15:56:38 UTC, Joe Pfeiffer  wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

>> > Knill has got it wrong. If the air escapes due to thermal exapansion, it 
>> > won't be replaced when temperature returns to equilibrium. No bubbles can
>> > be seen - OK, but attention is on the burning candle.
>> 
>> It's pretty clear that when he says "no bubbles can be seen" he means
>> "there are no bubbles", not that the students are just distracted by the
>> candle.
>>
>He hasn't observed any bubbles. One possibility is that there were no bubbles.
>Another is that bubbles were present but were not observed because attention
>was focused on the candle.
>Science is like that.

No, it's not.

[toc] | [prev] | [next] | [standalone]


#140569

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2019-02-05 10:35 -0800
Message-ID<a5527d7b-8a9c-45c1-8e62-f8144a5d721a@googlegroups.com>
In reply to#140564
On Tuesday, February 5, 2019 at 11:03:43 AM UTC-5, Malcolm McLean wrote:
...
> He hasn't observed any bubbles. One possibility is that there were no bubbles.
> Another is that bubbles were present but were not observed because attention
> was focused on the candle.
> Science is like that.

No, when conducting scientific experiments, the correct way to describe
the situation you refer to would be "no attempt was made to determine
whether bubbles were present". Anything else would be scientific
malpractice (which does, of course, occur). The wording actually used
implies that an attempt was made to detect bubbles, and that attempt
failed, despite being performed correctly. If that's not what actually
happened, he's guilty of misrepresentation. Do you have any evidence to
provide in support of that accusation?

[toc] | [prev] | [next] | [standalone]


#140576

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2019-02-05 12:34 -0800
Message-ID<03c049e9-29db-4b89-bf4d-9ab1cef35b49@googlegroups.com>
In reply to#140569
On Tuesday, 5 February 2019 18:35:46 UTC, James Kuyper  wrote:
> On Tuesday, February 5, 2019 at 11:03:43 AM UTC-5, Malcolm McLean wrote:
> ...
> > He hasn't observed any bubbles. One possibility is that there were no bubbles.
> > Another is that bubbles were present but were not observed because attention
> > was focused on the candle.
> > Science is like that.
> 
> No, when conducting scientific experiments, the correct way to describe
> the situation you refer to would be "no attempt was made to determine
> whether bubbles were present". Anything else would be scientific
> malpractice (which does, of course, occur). The wording actually used
> implies that an attempt was made to detect bubbles, and that attempt
> failed, despite being performed correctly. If that's not what actually
> happened, he's guilty of misrepresentation. Do you have any evidence to
> provide in support of that accusation?
>
It says a bit later in the webpage that the water level rose higher when
multiple candles were lit. Which supports the "undetected bubble"
hypothesis.
He's not guilty of misrepresentation, however. Just of doing science with
real materials and gathering real data.
 

[toc] | [prev] | [next] | [standalone]


#140568

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2019-02-05 10:31 -0800
Message-ID<cb11fb3c-ce75-4b02-86c7-28c866533f3a@googlegroups.com>
In reply to#140542
On Tuesday, February 5, 2019 at 4:37:26 AM UTC-5, Malcolm McLean wrote:
> On Monday, 4 February 2019 20:33:35 UTC, James Kuyper  wrote:
> > On Monday, February 4, 2019 at 6:35:48 AM UTC-5, Malcolm McLean wrote:
> > > On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
> > ...
> > > You can't. An example is the experiment that shows that air is about 20%
> > > oxygen. A candle is lit on a boat, over which is place a bell jar,
> > > resting on a tray of water. The oxygen in the sir is used up, and the candle
> > > goes out, and the water level in the bell jar rises.
> > > Except that most of the effect is from the heat of the candle forcing 
> > > expanded air out of the bell jar. The air inside the bell jar then
> > > cools.
> > 
> > This experiment?
> > <http://www.math.harvard.edu/~knill/pedagogy/waterexperiment/>? Read the
f> > explanation carefully - when done properly (and it's quite possible to
> > do it improperly), the initial water level is high enough that expansion
> > of the air does not result in any air leaving the bell jar.
> > 
> 
> From the website:
> 
> Argument: The experiment can be explained by physics alone. During the heating stage, air escapes. Afterwards, the air volume decreases and pulls the water up.
> 
> Source of the Error: the argument could work, if indeed the heating of the air would produce enough pressure that some air could leave. In that case, some air would be lost through the water. But one can observe that the water level stays up even if everything has gone back to normal temperature (say 10 minutes). No bubbles can be seen. 
> 
> Knill has got it wrong. If the air escapes due to thermal exapansion, it 
> won't be replaced when temperature returns to equilibrium.

Yes, that would be a problem if the experiment were conducted
incorrecly, but the case he describes was when the experiment was
conducted properly: the initial water level was set high enough that the
initial thermal expansion was insufficient to push the water level below
the bottom of the bell jar. Therefore, no air escaped, and therefore
none needed to be replaced.

> ... No bubbles can
> be seen - OK, but attention is on the burning candle.

When he says "No bubbles can be seen." he means that a serious attempt
was made to determine whether there were any bubbles, an attempt which
failed to detect any. He's not describing an failure to detect them due
to inattention.

Properly conducted, the test is performed as follows: It starts with the
bell jar covering the candle, with the water level inside the jar being
somewhat higher than the bottom of the jar (this requires tilting the
jar while putting it down). The candle burns, with  every 2 molecules of
cold O2 consumed being replaced by 1 CO2 and 2 water molecules, both of
them hot. The heat and the increase in the number of molecules both
cause the air volume to increase. But if properly set up, the increase
does not push the water below the bottom of the bell jar. As a result,
no bubbles are formed, which is why no bubbles were seen. Eventually,
there's too little O2 left to support continued combustion, and the
flame goes out. When the air cools down, the water molecules condense
out (as well as any volatile organic compounds evaporated from the
candle). The final result is that some of the O2 molecules have been
replace with half that number of CO2 molecules, so the final volume of
air in the jar has been reduced.

It's certainly possible to conduct this experiment incorrectly, so that
it fails to clearly demonstrate the principle that it's intended to
demonstrate. But that's true of any experiment. It's also possible to
conduct it correctly, and it's only the correctly conducted experiment
that's worth talking about.

[toc] | [prev] | [next] | [standalone]


#140566

FromJohn Bode <jfbode1029@gmail.com>
Date2019-02-05 08:55 -0800
Message-ID<a6478234-2c24-4eca-9db0-90a4f4dc33a0@googlegroups.com>
In reply to#140511
On Monday, February 4, 2019 at 5:35:48 AM UTC-6, Malcolm McLean wrote:
> On Sunday, 3 February 2019 20:46:58 UTC, Keith Thompson  wrote:
> > 
> > By telling this "white" lie, you help perpetuate the confusion about
> > the relationship between arrays and pointers in C.  I've had to
> > (well, I've chosen to) spend way too much time clearing up this
> > confusion, usually with a reference to section 6 of the comp.lang.c
> > FAQ.
> > 
> If you never simplify, it's often too hard for most students to understand.
> You wouldn't try to teach general relativity on a primary school time
> and motion exercise, after all.

But what Stephan is doing isn't *simplifying*, it's straight-up *misinforming*.  You're not
"simplifying" anything if you're teaching students something they will have to un-learn
later on.  

Better just to say "this syntax is magic, and I will explain the magic later," rather than 
make up explanations that are wrong.  Saying "the * means that the preceding thing
can be repeated arbitrarily often" is not a "white lie", that's Schildt-level misinformation.
You've now cemented the concept that "*" is a repeat operator, which is in a whole 
different galaxy of wrong.  

Pointers are a fundamental component of C programming and *cannot* be deferred
until late in the course.  You don't have to get deep in the weeds of pointer syntax,
but you need to introduce the basic concepts correctly at an early stage:

 To wit:

- A pointer is an expression whose value is the location of another object in memory;
- In a declaration "T *p;", the "*" indicates that the variable "p" is of pointer type, and that
   "p" stores an address value;
- In an expression "*p", the "*" indicates that we want the value of what "p" points to;
- In an expression "&x", the "&" indicates that we want the location of the variable "x"; 

C *requires* us to use pointers in 2 cases:

 - when we want a function to write to one of its arguments (such as "scanf( "%d", &x );")
 - when we want to track dynamically allocated memory

THAT'S NOT HORRIBLY COMPLICATED.  Yes, students who've never written a line of code 
before will struggle with the concept for a few days.  With lots of good examples, that 
struggle can be minimized.  And again, you can simply say "use this magic syntax for 
this case, we'll get into the details of it later".   But *don't* make up bullshit explanations.  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web