Re: technology discussion → does the world need a "new" C ?

Liste des GroupesRevenir à cl c 
Sujet : Re: technology discussion → does the world need a "new" C ?
De : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.c
Date : 16. Aug 2024, 11:00:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87jzggss6h.fsf@bsb.me.uk>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
David Brown <david.brown@hesbynett.no> writes:

On 16/08/2024 02:08, Ben Bacarisse wrote:
Bart <bc@freeuk.com> writes:

In general there is no reason, in a language with true call-by-reference,
why any parameter type T (which has the form U*, a pointer to anything),
cannot be passed by reference. It doesn't matter whether U is an array type
or not.
I can't unravel this.  Take, as a concrete example, C++.  You can't pass
a pointer to function that takes an array passed by reference.  You can,
of course, pass a pointer by reference, but that is neither here nor
there.
>
In C++, you can't pass arrays as parameters at all - the language inherited
C's handling of arrays.  You can, of course, pass objects of std::array<>
type by value or by reference, just like any other class types.

The best way to think about C++ (in my very non-expert opinion) is to
consider references as values that are passed by, err..., value.  But
you seem prepared to accept that some things can be "passed by reference"
in C++.  So if this:

#include <iostream>

void g(int &i) { std::cout << i << "\n"; }

int main(void)
{
   int I{0};
   g(I);
}

shows an int object, I, being passed to g, why does this

#include <iostream>

void f(int (&ar)[10]) { std::cout << sizeof ar << "\n"; }

int main(void)
{
   int A[10];
   f(A);
}

not show an array, A, being passed to f?

As I said, I don't think it's wise to look at it this way, but I am just
borrowing your use of terms to try to tease out what you are getting at.

--
Ben.

Date Sujet#  Auteur
5 Jul 24 * Re: technology discussion → does the world need a "new" C ?306Lawrence D'Oliveiro
5 Jul 24 `* Re: technology discussion → does the world need a "new" C ?305BGB
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?2Lawrence D'Oliveiro
5 Jul 24  i`- Re: technology discussion → does the world need a "new" C ?1yeti
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?275Keith Thompson
5 Jul 24  i+- Re: technology discussion → does the world need a "new" C ?1Lawrence D'Oliveiro
14 Jul 25  i`- 
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?26bart
5 Jul 24  i+- Re: technology discussion → does the world need a "new" C ?1BGB
6 Jul 24  i`* Re: technology discussion → does the world need a "new" C ?24Lawrence D'Oliveiro
6 Jul 24  i +* Re: technology discussion → does the world need a "new" C ?17Keith Thompson
6 Jul 24  i i+- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
6 Jul 24  i i`* Re: technology discussion → does the world need a "new" C ?15Lawrence D'Oliveiro
6 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Ben Bacarisse
6 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
7 Jul 24  i i +* Re: technology discussion → does the world need a "new" C ?10James Kuyper
10 Jul 24  i i i`* Re: technology discussion → does the world need a "new" C ?9Lawrence D'Oliveiro
10 Jul 24  i i i `* Re: technology discussion → does the world need a "new" C ?8James Kuyper
11 Jul 24  i i i  `* Re: technology discussion → does the world need a "new" C ?7Lawrence D'Oliveiro
11 Jul 24  i i i   +* Re: technology discussion → does the world need a "new" C ?2David Brown
11 Jul 24  i i i   i`- Re: technology discussion → does the world need a "new" C ?1Malcolm McLean
11 Jul 24  i i i   +* Re: technology discussion → does the world need a "new" C ?3bart
11 Jul 24  i i i   i`* Re: technology discussion → does the world need a "new" C ?2Chris M. Thomasson
12 Jul 24  i i i   i `- Re: technology discussion → does the world need a "new" C ?1Chris M. Thomasson
11 Jul 24  i i i   `- Re: technology discussion → does the world need a "new" C ?1James Kuyper
7 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
25 Aug 24  i i `- Re: technology discussion ? does the world need a "new" C ?1dave thompson 2
6 Jul 24  i +- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
6 Jul 24  i +- Re: technology discussion → does the world need a "new" C ?1James Kuyper
6 Jul 24  i `* Re: technology discussion → does the world need a "new" C ?4bart
7 Jul 24  i  `* Re: technology discussion → does the world need a "new" C ?3Keith Thompson
7 Jul 24  i   `* Re: technology discussion → does the world need a "new" C ?2bart
7 Jul 24  i    `- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
5 Jul 24  `- Re: technology discussion → does the world need a "new" C ?1lexi hale

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal