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

@ -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;
}

View file

@ -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) {