Re: segfault w/ block, but not file scope
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Sun, 08 Jan 2006 07:37:27 GMT
Richard Heathfield <invalid@xxxxxxxxxxxxxxx> writes:
> Keith Thompson said:
>> Then we need to make it very clear to J Random Newbie that C doesn't
>> support pass by reference as a languag construct.
>
> Right.
>
>> Don't say that the
>> "*" means pass by reference; say that the "*" means you're passing a
>> pointer value, which can be used to do the equivalent of pass by
>> reference.
>
> To a newbie, the two statements can seem equivalent, especially if he
> doesn't know what "pass by reference" is and has to go and look it up. Why
> use the phrase at all, when it doesn't add any value?
>
>> Until J Random Newbie is able to hold that entire complex
>> thought in his head, he's not going to be able to be an effective C
>> programmer.
>
> We can ease that journey by not giving him useless junk to remember.
>
>> Pass by reference is a very common and useful programming technique,
>> one that C supports quite well (though arguably a little more clumsily
>> than some other languages do).
>
> I know what you're saying, but I think that's an own-foot-shooting way to
> say it.
Ok, I see your point. I suppose it depends on the kind of newbie.
Personally, I learned Pascal before I learned C, so I already knew
about pass-by-value and pass-by-reference. From that perspective,
understanding that passing a pointer is the way to emulate
pass-by-reference in C was very important. Things might be different
for a non-programmer learning C.
On the other hand, I'm not sure that C is a good choice for a first
language. In any case, a programmer should *eventually* understand
the concepts of pass-by-value and pass-by-reference. And I tend to
think that it's at least as important to use C (or any language) as a
vehicle for learning about programming as it is to learn the details
of the language itself.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: segfault w/ block, but not file scope
- From: Chuck F.
- Re: segfault w/ block, but not file scope
- References:
- segfault w/ block, but not file scope
- From: Dieter
- Re: segfault w/ block, but not file scope
- From: Dieter
- Re: segfault w/ block, but not file scope
- From: Jack Klein
- Re: segfault w/ block, but not file scope
- From: Dieter
- Re: segfault w/ block, but not file scope
- From: M.B
- Re: segfault w/ block, but not file scope
- From: Richard Heathfield
- Re: segfault w/ block, but not file scope
- From: M.B
- Re: segfault w/ block, but not file scope
- From: Richard Heathfield
- Re: segfault w/ block, but not file scope
- From: Keith Thompson
- Re: segfault w/ block, but not file scope
- From: Richard Heathfield
- Re: segfault w/ block, but not file scope
- From: Keith Thompson
- Re: segfault w/ block, but not file scope
- From: Richard Heathfield
- Re: segfault w/ block, but not file scope
- From: Keith Thompson
- Re: segfault w/ block, but not file scope
- From: Richard Heathfield
- segfault w/ block, but not file scope
- Prev by Date: Re: Bit shifts and endianness
- Next by Date: Re: fwrite problems...
- Previous by thread: Re: segfault w/ block, but not file scope
- Next by thread: Re: segfault w/ block, but not file scope
- Index(es):
Relevant Pages
|