>>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: |
Lars> That's why I posted here. However, I fail to see how the two
Lars> forms I | posted may have any difference. Am I blind?

Lars> It looks correct to me as well.

I feel stupid, but it does not compile. What is the right way to do
this?

I get:

g++ -DHAVE_CONFIG_H -I. -I../../../../lyx-devel/src/frontends/xforms -I../../../src 
-I../../../../lyx-devel/images -I../../../../lyx-devel/src 
-I../../../../lyx-devel/src/frontends 
-I../../../../lyx-devel/src/frontends/controllers -I../../../../lyx-devel/boost 
-I/afs/rocq/home/preval/common/include -isystem /usr/X11R6/include -g -O 
-Wno-non-template-friend -ftemplate-depth-30 -W -Wall -c 
../../../../lyx-devel/src/frontends/xforms/xscreen.C -Wp,-MD,.deps/xscreen.TPlo
../../../../lyx-devel/src/frontends/xforms/xscreen.C: In method `void 
XScreen::draw(LyXText *, BufferView *, unsigned int)':
../../../../lyx-devel/src/frontends/xforms/xscreen.C:218: call of overloaded `abs 
(unsigned int)' is ambiguous
/usr/include/stdlib.h:699: candidates are: int abs(int)
/usr/local/gnu/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/cstdlib:17:
                 long int abs(long int)


Is that true that unsigned int - int == int ?

Shall I add static_cast<int>? That's ugly...

JMarc

Index: src/frontends/xforms//ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.649
diff -u -p -r1.649 ChangeLog
--- src/frontends/xforms//ChangeLog	8 Jan 2003 09:03:32 -0000	1.649
+++ src/frontends/xforms//ChangeLog	10 Jan 2003 10:34:14 -0000
@@ -1,3 +1,7 @@
+2003-01-09  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* xscreen.C (draw): simplify test
+
 2002-01-07  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
 
 	* FormTabular.C: typo.
Index: src/frontends/xforms//xscreen.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xscreen.C,v
retrieving revision 1.12
diff -u -p -r1.12 xscreen.C
--- src/frontends/xforms//xscreen.C	27 Nov 2002 10:30:25 -0000	1.12
+++ src/frontends/xforms//xscreen.C	10 Jan 2003 10:34:15 -0000
@@ -16,6 +16,7 @@
 #endif
 
 #include <algorithm>
+#include <cstdlib>
 #include <X11/Xlib.h>
 
 #include "frontends/screen.h"
@@ -33,6 +34,7 @@
 #include "language.h"
 #include "debug.h"
 
+using std::abs;
 using std::endl;
 using std::max;
 using std::min;
@@ -213,8 +215,7 @@ void XScreen::draw(LyXText * text, Buffe
 	text->first_y = y;
 
 	// is any optimization possible?
-	if ((y - old_first) < owner_.workHeight()
-	    && (old_first - y) < owner_.workHeight())
+	if (abs(y - old_first) < owner_.workHeight())
 	{
 		if (text->first_y < old_first) {
 			drawFromTo(text, bv, 0,

Reply via email to