Deutsch English Français Italiano |
<87plrmw2fl.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: Tue, 09 Jul 2024 16:50:06 -0700 Organization: None to speak of Lines: 30 Message-ID: <87plrmw2fl.fsf@nosuchdomain.example.com> References: <v66eci$2qeee$1@dont-email.me> <v687h2$36i6p$1@dont-email.me> <871q48w98e.fsf@nosuchdomain.example.com> <v68dsm$37sg2$1@dont-email.me> <87wmlzvfqp.fsf@nosuchdomain.example.com> <v6ard1$3ngh6$4@dont-email.me> <v6b0jv$3nnt6$1@dont-email.me> <87h6d2uox5.fsf@nosuchdomain.example.com> <v6d779$6rk5$2@dont-email.me> <v6e76u$c0i9$1@dont-email.me> <v6esqm$fian$2@dont-email.me> <v6f7vg$hgam$1@dont-email.me> <20240707164747.258@kylheku.com> <v6gl83$s72a$1@dont-email.me> <v6h8ao$ur1v$1@dont-email.me> <v6jhk3$1drd6$1@dont-email.me> <v6jiud$1dsjb$1@dont-email.me> <877cdur1z9.fsf@bsb.me.uk> <v6joi4$1epoj$1@dont-email.me> <20240709152805.587@kylheku.com> <v6kfm6$1ier7$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 10 Jul 2024 01:50:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2ff96a67704e58776cf4f9c1dffac965"; logging-data="1669484"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HuE9JFbD+e6C7W8BT2tBl" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:s1ETpsLvA8DLBuOUkReGdMKSGms= sha1:/jsWLsT5w7gpG8MfdP9Eukks3BE= Bytes: 2588 bart <bc@freeuk.com> writes: [...] > Arrays can be passed by explicit reference: > > void F(int(*A)[20]) { > printf("%zu\n", sizeof(*A)/sizeof((*A)[0])); // shows 20 > } > > That can be called like this: > > int a[20]; > F(&a); On the language level, that's passing a pointer to an array object. The pointer itself is passed by value. Passing a pointer to an array is conceptually no different than passing a pointer to anything else. C has pass-by-reference in exactly the same way that it has linked lists. It has neither as a language feature, but both can be emulated using pointers. And you can't really understand how C handles arrays if you start by asserting that they're "passed by reference". But you just have to make it seem more complicated than it really is. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */