:: Re: [DNG] Pointer error in the back…
Top Page
Delete this message
Reply to this message
Author: KatolaZ
Date:  
To: aitor_czr
CC: dng
Subject: Re: [DNG] Pointer error in the backend of Netman
On Thu, Dec 10, 2015 at 05:00:58PM +0100, aitor_czr wrote:
> No, Katolaz, passing by value and passing by reference exist in C,
> at least in C99.
>


Could you please give a pointer to the place where this feature is
documented in the ANSI C99 standard? Because it seems that the GCC
crew has overlooked it. If I try to compile:

============
#include <stdio.h>

void myfun(int &a){

a = 2*a;
}

int main (void){

int a = 10;
myfun(a);
}

===========

with

$ gcc -std=c99 reference.c

this is what I obtain:

reference.c:3:16: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
 void myfun(int &a){
                ^
reference.c: In function ‘main’:
reference.c:13:4: warning: implicit declaration of function ‘myfun’ [-Wimplicit-function-declaration]
    myfun(a);
    ^


So my version of gcc apparently does not know about this feature
included in the ANSI C99 standard....

HND

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]