Fix compiler warnings in examples when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type
This commit is contained in:
parent
879296f71b
commit
f39ed94419
43 changed files with 75 additions and 73 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue