[thuban-Bugs][206] wxproj.cpp calls to sqrt method is buggy with msvc++ toolkit 2003

thuban-bugs@wald.intevation.org thuban-bugs at wald.intevation.org
Mon Oct 23 11:18:57 CEST 2006


Bugs item #206, was opened at 2006-10-23 11:18
You can respond by visiting: 
http://wald.intevation.org/tracker/?func=detail&atid=105&aid=206&group_id=6
Or by replying to this e-mail entering your response between the following markers: 
#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+
(enter your response here)
#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+

Status: Open
Priority: 3
Submitted By: Didrik Pinte (dpinte)
Assigned to: Nobody (None)
Summary: wxproj.cpp calls to sqrt method is buggy with msvc++ toolkit 2003 
Resolution: None
Version: None
Category: None


Initial Comment:
While compiling thuban with MS VC++ Toolkit 2003 with the revision 2712, I get the following error :

libraries\thuban\wxproj.cpp(459) : error C2668: 'sqrt' : ambiguous call to overl
oaded function
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(626):
could be 'long double sqrt(long double)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(578):
or       'float sqrt(float)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(200):
or       'double sqrt(double)'
        while trying to match the argument list '(long)'
error: command '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"'
 failed with exit status 2

The corresponding line of code is the following : 

    len = (long)sqrt(vx * vx + vy * vy);

The Gnu C library does define only sqrt values with double input. Casting the inputs to double solve the problem on with this win32 compiler. This won't break the code for other architectures.

So here is the patch ;-)

    len = (long)sqrt( (double)vx * vx + vy * vy );


Does anybody has another good suggestion about this ? Or can we consider it has solved with my wonderful patch ?

Didrik

----------------------------------------------------------------------

You can respond by visiting: 
http://wald.intevation.org/tracker/?func=detail&atid=105&aid=206&group_id=6




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)