mirror of https://github.com/swig/swig
Fix compiler warnings in examples when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type
This commit is contained in:
parent
879296f71b
commit
f39ed94419
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,9 +57,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ void sort_int(int* arr, int len)
|
|||
qsort(arr, len, sizeof(int), compare_int);
|
||||
}
|
||||
|
||||
// ditto doubles
|
||||
/* ditto doubles */
|
||||
int compare_double(const void * a, const void * b)
|
||||
{
|
||||
return (int)( *(double*)a - *(double*)b );
|
||||
|
|
|
@ -45,14 +45,14 @@ void testModule(lua_State *L)
|
|||
swig_type_info *pTypeInfo=0,*pTypeInfo2=0;
|
||||
swig_module_info *pModule=0;
|
||||
pModule=SWIG_GetModule(L);
|
||||
DEBUG2(" SWIG_GetModule() returns %p\n",pModule)
|
||||
DEBUG2(" SWIG_GetModule() returns %p\n", (void *)pModule)
|
||||
if(pModule==0) return;
|
||||
pTypeInfo = SWIG_TypeQuery(L,"Foo *");
|
||||
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 *");
|
||||
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[])
|
||||
|
|
|
@ -53,7 +53,7 @@ int call_add(lua_State *L,int a,int b,int* res) {
|
|||
lua_getglobal(L, "add"); /* function to be called */
|
||||
if (!lua_isfunction(L,-1)) {
|
||||
printf("[C] error: cannot find function 'add'\n");
|
||||
lua_settop(L,top); // reset
|
||||
lua_settop(L,top);
|
||||
return 0;
|
||||
}
|
||||
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 */
|
||||
{
|
||||
printf("[C] error running function `add': %s\n",lua_tostring(L, -1));
|
||||
lua_settop(L,top); // reset
|
||||
lua_settop(L,top);
|
||||
return 0;
|
||||
}
|
||||
// check results
|
||||
/* check results */
|
||||
if (!lua_isnumber(L,-1)) {
|
||||
printf("[C] error: returned value is not a number\n");
|
||||
lua_settop(L,top); // reset
|
||||
lua_settop(L,top);
|
||||
return 0;
|
||||
}
|
||||
*res=(int)lua_tonumber(L,-1);
|
||||
lua_settop(L,top); /* reset stack */
|
||||
return 1; // ok
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* This is a variargs call function for calling from C into Lua.
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%include "typemaps.i" // you must have this for the typemaps for ptrs
|
||||
// basic function testing
|
||||
//
|
||||
%include "typemaps.i"
|
||||
|
||||
%inline %{
|
||||
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 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 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 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 */
|
||||
%}
|
||||
|
||||
|
|
|
@ -39,12 +39,15 @@ Square* createSquare(double w)
|
|||
return new Square(w);
|
||||
}
|
||||
|
||||
ShapeOwner::ShapeOwner() {printf(" ShapeOwner(%p)\n",this);}
|
||||
ShapeOwner::ShapeOwner() {
|
||||
printf(" ShapeOwner(%p)\n", (void *)this);
|
||||
}
|
||||
|
||||
ShapeOwner::~ShapeOwner()
|
||||
{
|
||||
printf(" ~ShapeOwner(%p)\n",this);
|
||||
for(unsigned i=0;i<shapes.size();i++)
|
||||
delete shapes[i];
|
||||
printf(" ~ShapeOwner(%p)\n", (void *)this);
|
||||
for(unsigned i=0;i<shapes.size();i++)
|
||||
delete shapes[i];
|
||||
}
|
||||
|
||||
void ShapeOwner::add(Shape* ptr) // this method takes ownership of the object
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,23 +19,23 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::as_string() {
|
||||
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;
|
||||
}
|
||||
|
||||
VectorArray::VectorArray(int size) {
|
||||
items = new Vector[size];
|
||||
maxsize = size;
|
||||
printf("VectorArray new: self=%p\n",this);
|
||||
printf("VectorArray new: self=%p\n", (void *)this);
|
||||
}
|
||||
|
||||
VectorArray::~VectorArray() {
|
||||
printf("VectorArray delete: self=%p\n",this);
|
||||
printf("VectorArray delete: self=%p\n", (void *)this);
|
||||
delete [] items;
|
||||
}
|
||||
|
||||
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)) {
|
||||
printf("Panic! Array index out of bounds.\n");
|
||||
exit(1);
|
||||
|
@ -44,6 +44,6 @@ Vector &VectorArray::operator[](int index) {
|
|||
}
|
||||
|
||||
int VectorArray::size() {
|
||||
printf("VectorArray: size %d self=%p\n",maxsize,this);
|
||||
printf("VectorArray: size %d self=%p\n", maxsize, (void *)this);
|
||||
return maxsize;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
/* This wrapper provides an alternative to the [] operator */
|
||||
%extend {
|
||||
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];
|
||||
}
|
||||
void set(int index, Vector &a) {
|
||||
|
|
|
@ -10,4 +10,4 @@ void Sync::printer(void) {
|
|||
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 x is %d\n", x);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
%inline %{
|
||||
|
||||
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);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
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("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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Manager* convert_to_Manager(PyObject *py_obj)
|
|||
{
|
||||
Manager* c_ptr;
|
||||
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) {
|
||||
c_ptr = 0;
|
||||
} else {
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual std::string getTitle() { return getPosition() + " " + getName(); }
|
||||
virtual std::string getName() { return name; }
|
||||
virtual std::string getPosition() const { return "Employee"; }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
|
||||
virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
|
|||
|
||||
char *Vector::print() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %p\n", (void *)iptrvar);
|
||||
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("status = %d\n", status);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue