:: Re: [DNG] Pointer error in the back…
Etusivu
Poista viesti
Vastaa
Lähettäjä: aitor_czr
Päiväys:  
Vastaanottaja: Irrwahn, dng
Aihe: Re: [DNG] Pointer error in the backend of Netman
Maybe...

Here you are the same program written in both languages:


CASE 1 (C Language):

# include <stdio.h>

void func(int*);

int main(void)
{
int i=1;
func(&i);
printf( "%d", i);
return 0;
}

void func(int *x)
{
*x = 2;
}


CASE 2 (C++ Language):

#include <iostream>

void func(int &);

int main()
{
int n = 1;
func(n);
std::cout << n;
return 0;
}

void func(int &x)
{
x = 2;
}

/ **** END **** /

CASE 1: The argument is not a reference, it's an address.

CASE 2: The argument is a reference

I have several books about C/C++ language (by G. Leblanc, Fco. Charte,
Javier Ceballos, etc...)

H. Schildt is the only one using this terminology in C.

Cheers,

    Aitor.


On 12/11/2015 10:04 AM, Irrwahn <irrwahn@???> wrote:
> Ceterum censeo: There is no pass by reference in C,
> has never been, and will presumably never be. Heck,
> the C standard doesn't mention the concept at all,
> not even in a non-normative foot note!
>
> HTH, HAND
> Irrwahn