Deutsch English Français Italiano |
<20240711113132.000015a4@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: technology discussion =?UTF-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Thu, 11 Jul 2024 11:31:32 +0300 Organization: A noiseless patient Spider Lines: 60 Message-ID: <20240711113132.000015a4@yahoo.com> References: <v66eci$2qeee$1@dont-email.me> <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> <v6k6i0$1h4d3$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> <86ikxd8czu.fsf@linuxsc.com> <v6mggd$20g3f$1@dont-email.me> <20240710213910.00000afd@yahoo.com> <v6mm02$21cpb$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Thu, 11 Jul 2024 10:31:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="cc2ba001c5d2368b495ec9c7cf5e7c33"; logging-data="2492964"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194iXPSpUhpPq4+vHm7afQN4eN0VorgNPI=" Cancel-Lock: sha1:RB4ShNttmyCzvQfsQTy0yyDHER0= X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32) Bytes: 4354 On Wed, 10 Jul 2024 20:04:35 +0100 bart <bc@freeuk.com> wrote: > On 10/07/2024 19:39, Michael S wrote: > > On Wed, 10 Jul 2024 18:30:54 +0100 > > bart <bc@freeuk.com> wrote: > > > >> On 10/07/2024 16:48, Tim Rentsch wrote: > >>> bart <bc@freeuk.com> writes: > >>> > >>>> I earlier asked this: > >>>> > >>>> "So if arrays aren't passed by value in C, and they aren't passed > >>>> by reference, then how the hell ARE they passed?!" > >>> > >>> They aren't. C allows lots of things to be passed as an argument > >>> to a function: several varieties of numeric values, structs, > >>> unions, and pointers, including both pointers to object types and > >>> pointers to function types. C does not have a way for a function > >>> to take an argument that is either an array or a function. There > >>> is a way to take pointers to those things, but not the things > >>> themselves. Arrays and functions are second-class values in C. > >> > >> That's a good point. It's not just arrays that can't be passed by > >> value (because the language says so) but also functions (because > >> its not meaningful). > >> > >> Yet, although pointers to arrays and function can be passed > >> (without even doing anything special like using &), you are not > >> allowed to say that anything is passed by reference in C! > >> > >> The automatic conversion to a pointer, which is also a feature of > >> true pass-by-reference, doesn't count. > >> > >> Not needing an explicit deref inside the callee (another > >> characteristic of pass-by-reference) doesn't count either. > > > > It does not count, because automatic conversion to a pointer is not > > something that happens only during parameter passing. For arrays, it > > happens in all contexts except sizeof(). For functions, it happens > > in all contexts except function call. Or, may be, including > > function call, in this case (but not in case of arrays) it depends > > on point of view. > > Suppose that was to happen in all contexts, not just for arrays and > functions, but for all types. > > That means that if A, B, C were numbers, then any call such as F(A, > B, C) would pass the addresses of the numbers rather than their > values. > > According to what people have said, C would STILL be a language that > passed thing by value, and never by automatic reference. > > Yet in my scenario that now sounds ludicrous. > No, if dereference operator would be required consistently in nearly all contexts then it would not be ludicrous at all.