Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou 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: References: <87h6d2uox5.fsf@nosuchdomain.example.com> <20240707164747.258@kylheku.com> <877cdur1z9.fsf@bsb.me.uk> <871q42qy33.fsf@bsb.me.uk> <87ed82p28y.fsf@bsb.me.uk> <87r0c1nzjj.fsf@bsb.me.uk> <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> 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: 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