Deutsch   English   Français   Italiano  
<v6ramn$31q88$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: =?UTF-8?Q?Re:_technology_discussion_=e2=86=92_does_the_world_need_a?=
 =?UTF-8?Q?_=22new=22_C_=3f?=
Date: Fri, 12 Jul 2024 15:22:29 +0200
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <v6ramn$31q88$1@dont-email.me>
References: <v66eci$2qeee$1@dont-email.me> <v6ard1$3ngh6$4@dont-email.me>
 <v6b0jv$3nnt6$1@dont-email.me> <87h6d2uox5.fsf@nosuchdomain.example.com>
 <v6d779$6rk5$2@dont-email.me> <v6e76u$c0i9$1@dont-email.me>
 <v6esqm$fian$2@dont-email.me> <v6f7vg$hgam$1@dont-email.me>
 <20240707164747.258@kylheku.com> <v6gl83$s72a$1@dont-email.me>
 <v6h8ao$ur1v$1@dont-email.me> <v6jhk3$1drd6$1@dont-email.me>
 <v6jiud$1dsjb$1@dont-email.me> <877cdur1z9.fsf@bsb.me.uk>
 <v6joi4$1epoj$1@dont-email.me> <871q42qy33.fsf@bsb.me.uk>
 <v6k6i0$1h4d3$1@dont-email.me> <87ed82p28y.fsf@bsb.me.uk>
 <v6m03l$1tf05$1@dont-email.me> <87r0c1nzjj.fsf@bsb.me.uk>
 <v6m716$1urj4$1@dont-email.me> <87ikxconq4.fsf@bsb.me.uk>
 <v6n8iu$24af0$1@dont-email.me> <20240711115418.00001cdf@yahoo.com>
 <v6oamt$2d8nn$1@dont-email.me> <v6oct4$2djgq$2@dont-email.me>
 <v6of96$2ekb0$1@dont-email.me> <v6ovfc$2hcpf$1@dont-email.me>
 <v6p4hf$2icph$1@dont-email.me> <v6qgpu$2t6p7$3@dont-email.me>
 <v6r33m$30grj$1@dont-email.me> <v6r3iv$30gru$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 12 Jul 2024 15:22:31 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d85c4c2daeb3b08faa368b80fa429628";
	logging-data="3205384"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/J41tM7WGCJCphC+qjj2rn"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:dZ4/HKnExvd6/vfSnfoOKdQ8OGM=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <v6r3iv$30gru$1@dont-email.me>
Bytes: 4363

On 12.07.2024 13:21, bart wrote:
> On 12/07/2024 12:12, Janis Papanagnou wrote:
>> On 12.07.2024 08:00, David Brown wrote:
>>> [...]
>>>
>>> I can understand when someone new to C gets mixed up about how arrays
>>> work.
>>
>> I can't understand that if I presume that the person has read any
>> basic textbook about "C".
>>
>>> I don't understand how someone can remain so stubbornly confused
>>> when they have been told how C /actually/ works.
>>
>> Especially if the one has said to have written an own language that
>> is close enough to "C" where I'd expect the knowledge to be there
>> already before that person is designing and implementing his project.
>>
>> I wonder why he refuses to look up things if he thinks that all the
>> experts here are wrong about a well documented fact.
> 
> If you had to describe to someone how a function accesses array data in
> its caller, what would you say?

I would explain it as it is, in a way similar to what was already
written in this thread. (It had been formulated repeatedly and I
will not repeat it again.)

Someone here (don't recall who it was) already had provided a good
post about how difficult it gets if you build your argument around
an inappropriate model.

> 
> It's clearly not by value. It's apparently not by reference. You can't
> get away with saying they are not passed, as clearly functions *can*
> access array data via parameters.

To explain it to newbies I'd abstain from using parameter-passing
terms at all; and especially in "C" that's simple because you have
just one mechanism, so you don't need to mention it to distinguish
it from any other mechanisms [that exist in other languages].

I'd just explain what happens if you write  f(int a[]) and - since
the pointers are so basic a concept in "C" - I'd likely explain it
in terms of  f(int * p) .

> 
> Or would you merely refer to the relevant section in the language
> reference?

If you mean the standards' documents; no. I don't think that such
documents are good for learning or explaining a language. But they
help to get formal certainty about facts; useful for experts like
the ones here in this group (and certainly not excluding you).

> Just curious.

Fair enough.

Janis