"Thomas A. Gardiner" wrote: > On Mon, 25 Sep 2000, R. Lahaye wrote: > > int xmin=1e6,xmax=0,ymin=1e6,ymax=0; > While this might look strange, it should work just fine. > It's equivalent to > > int xmin=(int)1e6, xmax=0, ymin=(int)1e6, ymax=0;
I called it "errors in EditorWindow.C", but of course they were warnings by the compiler; just meant that this could be prone to errors. But I still consider this as an ugly programming technique. Every compiler will/should complain about this, because you may lose information by converting a float into an int. You yourself may know it's alright, but people who see these warnings coming by during compilation, may start wondering whether things will go well. So I would strongly suggest to add a cast into the CVS, to tell the compiler that the conversion float->int is alright. Same story for: > >(line 4361) int begx, begy; > > int endx, endy; > > > >(line 4421) begx = (x_pagesize * border_percent) * 72; > > begy = (y_pagesize * border_percent) * 72; > > endx = (x_pagesize * 72) - begx; > > endy = (y_pagesize * 72) - begy; > > > >because x/y_pagesize and border_percent are floats. > >Probably the assignments should become > > > > begx = int(x_pagesize * border_percent) * 72; > > etc. > > or > > begx = int(x_pagesize * border_percent * 72); > > etc. > > and/or > > use int(ceil( )) instead of simply int(). > > > > ( the latter needs also #include <math.h> ) Regards, Rob.
