Fix compiler warnings in examples when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type

This commit is contained in:
William S Fulton 2014-05-24 00:14:01 +01:00
commit f39ed94419
43 changed files with 75 additions and 73 deletions

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -57,9 +57,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -13,7 +13,7 @@ void sort_int(int* arr, int len)
qsort(arr, len, sizeof(int), compare_int); qsort(arr, len, sizeof(int), compare_int);
} }
// ditto doubles /* ditto doubles */
int compare_double(const void * a, const void * b) int compare_double(const void * a, const void * b)
{ {
return (int)( *(double*)a - *(double*)b ); return (int)( *(double*)a - *(double*)b );

View file

@ -45,14 +45,14 @@ void testModule(lua_State *L)
swig_type_info *pTypeInfo=0,*pTypeInfo2=0; swig_type_info *pTypeInfo=0,*pTypeInfo2=0;
swig_module_info *pModule=0; swig_module_info *pModule=0;
pModule=SWIG_GetModule(L); pModule=SWIG_GetModule(L);
DEBUG2(" SWIG_GetModule() returns %p\n",pModule) DEBUG2(" SWIG_GetModule() returns %p\n", (void *)pModule)
if(pModule==0) return; if(pModule==0) return;
pTypeInfo = SWIG_TypeQuery(L,"Foo *"); pTypeInfo = SWIG_TypeQuery(L,"Foo *");
DEBUG2(" Type (Foo*) is %s\n",pTypeInfo==0?"unknown":"known"); DEBUG2(" Type (Foo*) is %s\n",pTypeInfo==0?"unknown":"known");
DEBUG3(" Module %p typeinfo(Foo*) %p\n",pModule,pTypeInfo); DEBUG3(" Module %p typeinfo(Foo*) %p\n", (void *)pModule, (void *)pTypeInfo);
pTypeInfo2 = SWIG_TypeQuery(L,"Bar *"); pTypeInfo2 = SWIG_TypeQuery(L,"Bar *");
DEBUG2(" Type (Bar*) is %s\n",pTypeInfo2==0?"unknown":"known"); DEBUG2(" Type (Bar*) is %s\n",pTypeInfo2==0?"unknown":"known");
DEBUG3(" Module %p typeinfo(Bar*) %p\n",pModule,pTypeInfo2); DEBUG3(" Module %p typeinfo(Bar*) %p\n", (void *)pModule, (void *)pTypeInfo2);
} }
int main(int argc,char* argv[]) int main(int argc,char* argv[])

View file

@ -53,7 +53,7 @@ int call_add(lua_State *L,int a,int b,int* res) {
lua_getglobal(L, "add"); /* function to be called */ lua_getglobal(L, "add"); /* function to be called */
if (!lua_isfunction(L,-1)) { if (!lua_isfunction(L,-1)) {
printf("[C] error: cannot find function 'add'\n"); printf("[C] error: cannot find function 'add'\n");
lua_settop(L,top); // reset lua_settop(L,top);
return 0; return 0;
} }
lua_pushnumber(L,a); lua_pushnumber(L,a);
@ -61,18 +61,18 @@ int call_add(lua_State *L,int a,int b,int* res) {
if (lua_pcall(L, 2, 1, 0) != 0) /* call function with 2 arguments and 1 result */ if (lua_pcall(L, 2, 1, 0) != 0) /* call function with 2 arguments and 1 result */
{ {
printf("[C] error running function `add': %s\n",lua_tostring(L, -1)); printf("[C] error running function `add': %s\n",lua_tostring(L, -1));
lua_settop(L,top); // reset lua_settop(L,top);
return 0; return 0;
} }
// check results /* check results */
if (!lua_isnumber(L,-1)) { if (!lua_isnumber(L,-1)) {
printf("[C] error: returned value is not a number\n"); printf("[C] error: returned value is not a number\n");
lua_settop(L,top); // reset lua_settop(L,top);
return 0; return 0;
} }
*res=(int)lua_tonumber(L,-1); *res=(int)lua_tonumber(L,-1);
lua_settop(L,top); /* reset stack */ lua_settop(L,top); /* reset stack */
return 1; // ok return 1;
} }
/* This is a variargs call function for calling from C into Lua. /* This is a variargs call function for calling from C into Lua.

View file

@ -1,13 +1,12 @@
/* File : example.i */ /* File : example.i */
%module example %module example
%include "typemaps.i" // you must have this for the typemaps for ptrs %include "typemaps.i"
// basic function testing
//
%inline %{ %inline %{
extern int add1(int x, int y); // return x+y -- basic function test extern int add1(int x, int y); /* return x+y -- basic function test */
extern void add2(int x, int *INPUT, int *OUTPUT); // *z = x+*y -- argin and argout test extern void add2(int x, int *INPUT, int *OUTPUT); /* *z = x+*y -- argin and argout test */
extern int add3(int x, int y, int *OUTPUT); // return x+y, *z=x-y -- returning 2 values extern int add3(int x, int y, int *OUTPUT); /* return x+y, *z=x-y -- returning 2 values */
extern void add4(int x, int *INOUT); // *y += x -- INOUT dual purpose variable extern void add4(int x, int *INOUT); /* *y += x -- INOUT dual purpose variable */
%} %}

View file

@ -39,10 +39,13 @@ Square* createSquare(double w)
return new Square(w); return new Square(w);
} }
ShapeOwner::ShapeOwner() {printf(" ShapeOwner(%p)\n",this);} ShapeOwner::ShapeOwner() {
printf(" ShapeOwner(%p)\n", (void *)this);
}
ShapeOwner::~ShapeOwner() ShapeOwner::~ShapeOwner()
{ {
printf(" ~ShapeOwner(%p)\n",this); printf(" ~ShapeOwner(%p)\n", (void *)this);
for(unsigned i=0;i<shapes.size();i++) for(unsigned i=0;i<shapes.size();i++)
delete shapes[i]; delete shapes[i];
} }

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %x (%g,%g,%g)", (int)this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
} }
void vector_print(Vector *v) { void vector_print(Vector *v) {
printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z);
} }
%} %}

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,23 +19,23 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::as_string() { char *Vector::as_string() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }
VectorArray::VectorArray(int size) { VectorArray::VectorArray(int size) {
items = new Vector[size]; items = new Vector[size];
maxsize = size; maxsize = size;
printf("VectorArray new: self=%p\n",this); printf("VectorArray new: self=%p\n", (void *)this);
} }
VectorArray::~VectorArray() { VectorArray::~VectorArray() {
printf("VectorArray delete: self=%p\n",this); printf("VectorArray delete: self=%p\n", (void *)this);
delete [] items; delete [] items;
} }
Vector &VectorArray::operator[](int index) { Vector &VectorArray::operator[](int index) {
printf("VectorArray: read[%d] self=%p\n",index,this); printf("VectorArray: read[%d] self=%p\n", index, (void *)this);
if ((index < 0) || (index >= maxsize)) { if ((index < 0) || (index >= maxsize)) {
printf("Panic! Array index out of bounds.\n"); printf("Panic! Array index out of bounds.\n");
exit(1); exit(1);
@ -44,6 +44,6 @@ Vector &VectorArray::operator[](int index) {
} }
int VectorArray::size() { int VectorArray::size() {
printf("VectorArray: size %d self=%p\n",maxsize,this); printf("VectorArray: size %d self=%p\n", maxsize, (void *)this);
return maxsize; return maxsize;
} }

View file

@ -37,7 +37,7 @@ public:
/* This wrapper provides an alternative to the [] operator */ /* This wrapper provides an alternative to the [] operator */
%extend { %extend {
Vector &get(int index) { Vector &get(int index) {
printf("VectorArray extended get: %p %d\n",$self,index); printf("VectorArray extended get: %p %d\n", (void *)$self, index);
return (*$self)[index]; return (*$self)[index];
} }
void set(int index, Vector &a) { void set(int index, Vector &a) {

View file

@ -10,4 +10,4 @@ void Sync::printer(void) {
printf("The value of global x is %d\n", x); printf("The value of global x is %d\n", x);
printf("The value of class s is %s\n", s); printf("The value of class s is %s\n", s);
printf("The value of class x is %d\n", x); printf("The value of class x is %d\n", x);
}; }

View file

@ -11,7 +11,7 @@
%inline %{ %inline %{
void vector_print(Vector *v) { void vector_print(Vector *v) {
printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z);
} }
%} %}

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]); printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]);
printf("ptptr = %p %s\n", ptptr, Point_print( ptptr ) ); printf("ptptr = %p %s\n", (void *)ptptr, Point_print( ptptr ) );
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -9,7 +9,7 @@ Manager* convert_to_Manager(PyObject *py_obj)
{ {
Manager* c_ptr; Manager* c_ptr;
swig_type_info *ty = SWIG_TypeQuery("Manager *"); swig_type_info *ty = SWIG_TypeQuery("Manager *");
printf("manager ty %p \n", ty); printf("manager ty %p \n", (void *)ty);
if (SWIG_ConvertPtr(py_obj, (void **) &c_ptr, ty, 0) == -1) { if (SWIG_ConvertPtr(py_obj, (void **) &c_ptr, ty, 0) == -1) {
c_ptr = 0; c_ptr = 0;
} else { } else {

View file

@ -14,7 +14,7 @@ public:
virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; } virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; } virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); } virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
}; };

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
} }
void vector_print(Vector *v) { void vector_print(Vector *v) {
printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z);
} }
%} %}

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }

View file

@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() { char *Vector::print() {
static char temp[512]; static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp; return temp;
} }

View file

@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
} }
void vector_print(Vector *v) { void vector_print(Vector *v) {
printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z);
} }
%} %}

View file

@ -52,9 +52,9 @@ void print_vars() {
printf("cvar = %c\n", cvar); printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar); printf("cstrvar = %s\n", cstrvar);
printf("iptrvar = %p\n", iptrvar); printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name); printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y); printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status); printf("status = %d\n", status);
} }