go to www.geomview.org home page
 
Home

Overview
FAQ
Documentation

Download

Mailing List

Geomview For Windows?

Support
Users
Development

Bug Reporting
Contributing
Contact Us

Sponsors

 

Site Search

 

Advanced
Search

 
About the software@geom archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Closed REQ 5397]: hardy mystery


  • To: software@geom
  • Subject: Re: [Closed REQ 5397]: hardy mystery
  • From: "Daeron Meyer" <daeron>
  • Date: Tue, 16 May 95 3:38:59 CDT

> 
> Date: Mon, 15 May 95 23:04:58 -0500
> From: bradb
> Message-Id: <9505160404.AA03612 at hardy.geom.umn.edu>
> To: software
> Subject: hardy mystery
> 
> 
> Hi,
> 
> I'm releasing a new version of Qhull and ran into some very
> strange behavior from hardy.  This happened whether I was
> compiling with gcc or with cc and fat binaries.
> 
> 
> This code==>
> 
> void qh_printpoint(FILE *fp, char *string, double *point) {
>   int k,id;
>   double *p;
>   
>   if (!point)
>     return;
>   fprintf (stdout, "point %x %2.2g %2.2g %2.2g\n", (int) point, point[0], point[1], point[2]);
>   p= point;
>   fprintf (stdout, "point %2.2g %x %2.2g %x %2.2g %x %2.2g %x\n", *p, (int)p, 
>        *p++, (int)p, *p++, (int)p, *p++, (int) p);
> 
>   for(k= 3; k--; ) {
>       fprintf(stdout, " %2.2g", *point++);
>   }
>   fprintf(fp, "\n");
> } /* printpoint */
> 
> ==== produces this result  ==>
> 
> point 75470  0  0 -0.5
> point  0 75470  0 75478  0 75480 -0.5 75488
>   0 -0.5  0
> 
> ==============
> 
> the first two lines are right, the third is offset by one.  This
> happens for every triple of doubles.  If I change the loop to
> read:
> 
>   for(k= 3; k--; ) {
> 	p= point;
>       fprintf(stdout, " %x %2.2g", (int) p, *point++);
>   }
> 
> it works fine.  The code works fine on godel and gauss.  I'm stuck.
> Any ideas?
> 
> 					--Brad
> 
> P.S.: This is from ~bradb/qhull/Install/qhull_hardy/io.c
> I was compiling with gcc .
> 
> 
> 

Hello Brad,

You might be having problems with pointer corruption... I tried
creating a simple program based on your function and it worked
just fine.  Here it is, try compiling it yourself:

#include <stdio.h>

void qh_printpoint(FILE *, char *, double *);

void qh_printpoint(FILE *fp, char *string, double *point) {
  int k,id;
  double *p;

  if (!point)
    return;
  fprintf (stdout, "point %x %2.2g %2.2g %2.2g\n", (int) point, point[0], point\
[
1], point[2]);
  p= point;
  fprintf (stdout, "point %2.2g %x %2.2g %x %2.2g %x %2.2g %x\n", *p, (int)p,
       *p++, (int)p, *p++, (int)p, *p++, (int) p);

  for(k= 3; k--; ) {
      fprintf(stdout, " %2.2g", *point++);
  }
/*   fprintf(fp, "\n");*/
} /* printpoint */

int main(int argc, char **argv) {
  double x[8];
  x[0]=0.0;x[1]=0.0;x[2]= -0.5;
  qh_printpoint((FILE *)NULL, (char *)NULL, x);
}


 
Home | Overview | FAQ | Documentation | Support | Download | Mailing List
Windows? | Development | Bug Reporting | Contributing | Contact Us | Sponsors
 
site hosted by
SourceForge Logo