| Deutsch English Français Italiano |
|
<877cchfo7i.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.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 14:52:49 -0700
Organization: None to speak of
Lines: 41
Message-ID: <877cchfo7i.fsf@nosuchdomain.example.com>
References: <v66eci$2qeee$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> <86a5hep45h.fsf@linuxsc.com>
<v9ktep$v5sk$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 15 Aug 2024 23:52:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d131e61d7d14c369dab7c976096a7dbc";
logging-data="1158926"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+53Ho5r5+5qOUYHVWtXhYO"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:Hg6DwRxGWWLGMS+wzLYkc17m8Xs=
sha1:Qn1sEtILk2NEtMlISf1Zrhp9AHA=
Bytes: 3256
Bart <bc@freeuk.com> writes:
[...]
> However your entry for pointers is not correct: you can pass pointers
> by reference (in C, it means passing a T** type instead of T* to
> emulate that).
You can *emulate* passing a pointer object by reference in C. You do so
by passing a pointer to the pointer object (or equivalently, the address
of the pointer object). The pointer to the pointer object is of course
passed by value, like all C function arguments.
No doubt you'll complain that I'm being overly pedantic. In fact I'm
pointing out an important distinction that you're glossing over *in a
discussion of that distinction*.
[...]
> Pass-by-reference necessarily requires an lvalue at the call-site
> since it effectively applies & to the argument.
But a (perhaps hypothetical) non-C language could use pass-by-reference
with a non-lvalue argument. It could do so by creating an implicit
object, initializing it to the argument value, and passing that object
by reference. (I understand that early Fortran did that, leading to the
possibility of CALL FOO(0) changing the value of 0.)
[...]
> That's one of the small differences. But you only get the array size
> in a language where the array type includes its length. Otherwise, you
> only get it if it's part of the parameter type.
A C array type does include its length. int[10] and int[20] are
distinct types. The implicit conversion of an array expression to a
pointer expression loses the length information.
[...]
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */