Modify

Ticket #2264 (closed Bugs: fixed)

Opened 9 years ago

Last modified 9 years ago

Warning C4244 in VS2005 build for PocketPC

Reported by: Juraj Novák <beeblbrox@…> Owned by: danieljames
Milestone: Boost 1.37.0 Component: hash
Version: Boost 1.36.0 Severity: Cosmetic
Keywords: Cc:

Description

I am getting these two warnings:

1>include\boost/functional/detail/float_functions.hpp(91) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data 1>include\boost/functional/detail/float_functions.hpp(118) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data

They can be easily fixed with an explicit cast to float. These warnings occur in functions call_ldexp and call_frexp in part conditioned with BOOST_HASH_C99_NO_FLOAT_FUNCS and BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS.

Attachments

output1.txt Download (283 bytes) - added by Juraj Novák <beeblbrox@…> 9 years ago.
Output from test_float1.cpp
output2.txt Download (295 bytes) - added by Juraj Novák <beeblbrox@…> 9 years ago.
Output from test_float2.cpp

Change History

comment:1 Changed 9 years ago by danieljames

  • Status changed from new to assigned

An explicit cast wouldn't be a good idea because it can hide potential problems. If that's the only solution, then I'd want to use a macro to only enable it when it's needed.

Please can you run the programs attached to the mail at  http://lists.boost.org/Archives/boost/2005/04/83834.php, and attach the output to this ticket. And the output from libs/config/test/config_info.cpp in boost would also be helpful. That should at least give me an idea of the situation. Thanks.

Changed 9 years ago by Juraj Novák <beeblbrox@…>

Output from test_float1.cpp

Changed 9 years ago by Juraj Novák <beeblbrox@…>

Output from test_float2.cpp

comment:2 Changed 9 years ago by Juraj Novák <beeblbrox@…>

It seems the platform does support float versions of math functions. I didn't run config_info.cpp, because my platform is a standard VS2005/PocketPC2003 project running on WM5.

comment:3 Changed 9 years ago by danieljames

I wanted to see the output of config_info so that I could see what macros the platform sets as I don't have access to it myself. But it seems that the best thing to do is always use the c99 functions for the Dinkumware libraries so I'll change it to do that.

comment:4 Changed 9 years ago by danieljames

(In [48529]) Always use c99 float function overloads on Dinkumware, as it doesn't always have the C++ overloads. Refs #2264.

comment:5 Changed 9 years ago by danieljames

(In [48674]) Reinstate the old choice of float functions on Dinkumware for all compilers other than Visual C++.

It turns out that Borland uses Dinkumware but doesn't have the C99 float overloads, so it only seems realistic to assume their existence on Visual C++. Refs #2264.

comment:6 Changed 9 years ago by danieljames

Okay, I think the current trunk gets it right, can you test it? If it works for you, I'll merge into release and close this ticket.

comment:7 Changed 9 years ago by Juraj Novák <beeblbrox@…>

The code compiles without warning now. I think it is OK.

comment:8 Changed 9 years ago by danieljames

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [48739]) Always use c99 float function overloads when using Dinkumware with Visual C++, as it doesn't always have the C++ overloads. Fixes #2264.

Merged revisions 48529,48674 via svnmerge from  https://svn.boost.org/svn/boost/trunk

........

r48529 | danieljames | 2008-09-02 11:31:26 +0100 (Tue, 02 Sep 2008) | 1 line

Always use c99 float function overloads on Dinkumware, as it doesn't always have the C++ overloads. Refs #2264.

........

r48674 | danieljames | 2008-09-08 22:06:16 +0100 (Mon, 08 Sep 2008) | 7 lines

Reinstate the old choice of float functions on Dinkumware for all compilers other than Visual C++.

It turns out that Borland uses Dinkumware but doesn't have the C99 float overloads, so it only seems realistic to assume their existence on Visual C++. Refs #2264.

........

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.