Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Fri, 12 Jul 2024 13:38:24 -0700 Organization: None to speak of Lines: 75 Message-ID: <87o772s5vj.fsf@nosuchdomain.example.com> References: <871q42qy33.fsf@bsb.me.uk> <87ed82p28y.fsf@bsb.me.uk> <87r0c1nzjj.fsf@bsb.me.uk> <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> <87wmlqsitc.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Fri, 12 Jul 2024 22:38:24 +0200 (CEST) Injection-Info: dont-email.me; posting-host="f6a4ae00b1d1f7396bcd7741519ff487"; logging-data="3349492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SgzkkH2eWo2yNhLuYv6dx" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:m7P02yJhY/gTW+f84aURI1Fh5xg= sha1:a0p/g0rit9GdvuKwDsnpvpBlu3o= Xref: csiph.com comp.lang.c:387112 bart writes: > On 12/07/2024 16:58, Keith Thompson wrote: >> bart writes: >> [...] >>> If you had to describe to someone how a function accesses array data >>> in its caller, what would you say? >> The same thing I've written to you many times over the last several >> years in this newsgroup. >> >>> 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. >> Yes, function can access array data by means other than passing >> arrays >> as parameters. >> >>> Or would you merely refer to the relevant section in the language reference? >> That, and to section 6 of the comp.lang.c FAQ, which is an excellent >> description of C's treatment of arrays and pointers. You've repeatedly >> declined to say whether you've read it. I encourage you to do so. >> >>> Just curious. >> Sure you are. > > Actually, I /was/ genuinely curious as to how a function's access to > its caller's array elements are described without using 'pointer' or > 'reference'. So now you're restricting the words that can be used in the explanation. You didn't mention that restriction before. You're moving the goalposts. Any accurate explanation of how a function accesses elements of what looks like an array parameter depends on pointers. I believe you understand that perfectly well, but if you want to ask about some specific code I might consider explaining it yet again. "Reference" is an informal term that describes what pointers are. The problem is that it's also a formal term that refers to features that C doesn't have (C++-style references and function arguments passed by reference). > Because as AFAIK this whole subthread seems to about people trying to > catch me out on some pedantry. > > All it needed was for someone to agree that yes, arrays are > /effectively/ passed by reference, even if it's not true by-reference > and not a general purpose feature of the language. If I'm not mistaken, I don't believe you've ever acknowledged the underlying mechanism of how arrays are "passed" to functions. Will you do so now? Given: void func(int param[10]) { ... param[5] ... } ... int argument[10] = ...; func(argument); can *you* explain the semantics in terms consistent with the way the C standard describes them? (This is of course an incomplete code fragment. I can provide a complete program if you think it's necessary.) [...] Your acknowledgement that you've read section 6 of the comp.lang.c FAQ is a prerequisite to any further substantive response from me. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */