Deutsch   English   Français   Italiano  
<8734ohvwqs.fsf@nosuchdomain.example.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: 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: Wed, 10 Jul 2024 13:05:15 -0700
Organization: None to speak of
Lines: 46
Message-ID: <8734ohvwqs.fsf@nosuchdomain.example.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> <20240709152805.587@kylheku.com>
	<v6kfm6$1ier7$1@dont-email.me>
	<87plrmw2fl.fsf@nosuchdomain.example.com>
	<v6kl5v$1j8l7$1@dont-email.me>
	<87le2avyd1.fsf@nosuchdomain.example.com>
	<v6lmpo$1s105$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Wed, 10 Jul 2024 22:05:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2ff96a67704e58776cf4f9c1dffac965";
	logging-data="2150127"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+wTUla7ZlAXOefuVLxgunz"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:Vpi5z7/eRWllzXKyxjG2FZ7ZAgM=
	sha1:Q3/l2MRJphglllJ6kNAve2L1npI=
Bytes: 3330

bart <bc@freeuk.com> writes:
> On 10/07/2024 02:18, Keith Thompson wrote:
[...]
>> If you actually believed that C has pass-by-reference for arrays, it
>> would indicate that you don't understand C.  But you're only pretending
>> to believe it.
>> 
>> If C had pass-by-reference for arrays, then presumably you could
>> obtain the size of an array parameter by applying sizeof to its name,
>
> That's what my example did. But only if the array has a specific bound
> in the parameter type, not if it's unbounded, since (1) a function can
> be passed arrays of different sizes; (2) C arrays don't normally
> contain their length.

No, that's not what your example did.  Your example was:

    void F(int(*A)[20])

You defined A explicitly as a pointer.

I believe you understand what I actually meant by "If C had
pass-by-reference for arrays, then presumably you could obtain the size
of an array parameter by applying sizeof to its name".  If you tell me
that you don't honestly don't understand it and that you really beleve
that your example is the same thing, I'll explain it yet again.

[...]

> 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 doesn't have array parameters.  You can emulate array
parameters using pointers.  The emulation is not perfect.

>                                                Pretend you have to
> give a quick answer to a child; or an alien.

No.

bart, have you read section 6 of the comp.lang.c FAQ?
Yes or no, please.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */