Deutsch English Français Italiano |
<v6kjd6$1j3jk$1@dont-email.me> 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: BGB <cr88192@gmail.com> Newsgroups: comp.lang.c Subject: =?UTF-8?Q?Re=3A_technology_discussion_=E2=86=92_does_the_world_need?= =?UTF-8?B?IGEgIm5ldyIgQyA/?= Date: Tue, 9 Jul 2024 19:08:06 -0500 Organization: A noiseless patient Spider Lines: 45 Message-ID: <v6kjd6$1j3jk$1@dont-email.me> 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> <871q42qy33.fsf@bsb.me.uk> <v6k26q$1g7uk$2@dont-email.me> <87plrmp37i.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 10 Jul 2024 02:08:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6e5e054ad72cad2975b001804a5e3bdb"; logging-data="1674868"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AQDxnGvzUkdp7wgWnTDGQcnMi6JcYdTI=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:AVr0bITP/d1DjwbssFLP40ACDpA= Content-Language: en-US In-Reply-To: <87plrmp37i.fsf@bsb.me.uk> Bytes: 3354 On 7/9/2024 6:15 PM, Ben Bacarisse wrote: > BGB <cr88192@gmail.com> writes: > >> On 7/9/2024 12:22 PM, Ben Bacarisse wrote: >>> bart <bc@freeuk.com> writes: >>> >>>> On 09/07/2024 16:58, Ben Bacarisse wrote: >>>>> bart <bc@freeuk.com> writes: >>>>> >>>>>> Arrays are passed by reference: >>>>>> >>>>>> void F(int a[20]) {} >>>>>> >>>>>> int main(void) { >>>>>> int x[20]; >>>>>> F(x); >>>>>> } >>>>> This is the sort of thing that bad tutors say to students so that they >>>>> never learn C properly. All parameter passing in C is by value. All of >>>>> it. You just have to know (a) what the syntax means and (b) what values >>>>> get passed. >>>> >>>> The end result is that a parameter declared with value-array syntax is >>>> passed using a reference rather than by value. >>>> >>>> And it does so because the language says, not because the ABI requires >>>> it. A 2-byte array is also passed by reference. >>> An address value is passed by value. C has only one parameter passing >>> mechanism. You can spin it as much as you like, but C's parameter >>> passing is simple to understand, provided learner tune out voices like >>> yours. >> >> Though, in ABI specs, this would usually still be termed as "pass by >> reference" > > I am not saying that Bart is alone in getting this wrong. Any document > that that says that C have any parameter passing mechanism other than > pass by value is wrong. But then I doubt any ABI spec says that since > an ABI is, almost by definition, not about the C language. > True enough. ....