Y
Your Uncle
/* begin port to c++ */
# ifdef __cplusplus
extern "C" {
# endif
int * get_an_int(void);
int * pass_pointer_triv(int *);
# ifdef __cplusplus
}
# endif
/* end port to c++ */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int *rt, *qt;
qt = get_an_int();
rt = pass_pointer_triv(qt);
printf ("t is %d\n", *rt);
printf ("tja\n");
return 0;
}
int * get_an_int(void)
{
int t;
int * pt;
pt = malloc (sizeof*pt);
t = 41;
pt[0] = t;
return pt;
}
pass_pointer_triv(int *a)
{
int t;
t = *a;
printf("t is %d\n", t);
return a;
}
/* end source */
I believe that this source is one silly error away from being kosher c++.
My compiler tells me that the trivial pointer pass varies in level of
indirection, but to my eye, it all looks the same. I believe that my
compiler is correct. Grateful for any hints. furunculus
# ifdef __cplusplus
extern "C" {
# endif
int * get_an_int(void);
int * pass_pointer_triv(int *);
# ifdef __cplusplus
}
# endif
/* end port to c++ */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int *rt, *qt;
qt = get_an_int();
rt = pass_pointer_triv(qt);
printf ("t is %d\n", *rt);
printf ("tja\n");
return 0;
}
int * get_an_int(void)
{
int t;
int * pt;
pt = malloc (sizeof*pt);
t = 41;
pt[0] = t;
return pt;
}
pass_pointer_triv(int *a)
{
int t;
t = *a;
printf("t is %d\n", t);
return a;
}
/* end source */
I believe that this source is one silly error away from being kosher c++.
My compiler tells me that the trivial pointer pass varies in level of
indirection, but to my eye, it all looks the same. I believe that my
compiler is correct. Grateful for any hints. furunculus