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: Thu, 15 Aug 2024 14:52:49 -0700 Organization: None to speak of Lines: 41 Message-ID: <877cchfo7i.fsf@nosuchdomain.example.com> References: <87r0c1nzjj.fsf@bsb.me.uk> <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> <20240712154252.00005c2f@yahoo.com> <86o7717jj1.fsf@linuxsc.com> <20240717163457.000067bb@yahoo.com> <86a5hep45h.fsf@linuxsc.com> 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= Xref: csiph.com comp.lang.c:387589 Bart 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 */