Deutsch English Français Italiano |
<86a5hep45h.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Thu, 15 Aug 2024 01:43:38 -0700 Organization: A noiseless patient Spider Lines: 47 Message-ID: <86a5hep45h.fsf@linuxsc.com> References: <v66eci$2qeee$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> <20240712154252.00005c2f@yahoo.com> <86o7717jj1.fsf@linuxsc.com> <v6ti10$3gru4$1@dont-email.me> <v78af7$1qkuf$1@dont-email.me> <20240717163457.000067bb@yahoo.com> <v78piu$1su4u$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 15 Aug 2024 10:43:39 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ea18f1ad42e487cc51a7cbceb5bfd3a2"; logging-data="947424"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kwCQcy5HnLLBdI+KRKkXFuBkKJnD+r48=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:S1Zgx0e3FM22JINqlneJ3YRkEa4= sha1:KhZdecMk9rghsiEj2ns4cz/785I= Bytes: 3030 Bart <bc@freeuk.com> writes: [on comparing array arguments in C with call-by-reference] > [...] the differences [between C rules and true call-by-reference] > can be summarised here; [...] > > Call Array access in callee > > C call-by-value F(A) A[i] > > true call-by-reference H(A) A[i] > > What the user has to write is what's important, and here it is clear > that they write the same thing [in the two cases shown]. The comparison above is misleading because it is incomplete. Let's compare the two modes more fully: C call-by-value call-by-reference =============== ================= at call: (array argument) F(A) H(A) (pointer argument) F(p) (disallowed) (null argument) F(0) (disallowed) inside function: (access) A[i] A[i] (update) A[i] = ... A[i] = ... sizeof A (pointer size) (array size) A++ (changes A variable) (disallowed) A = (new value) (changes A variable) (disallowed) The more complete comparion illustrate why C semantics should not be thought of as call-by-reference.