Boost logo

Boost Users :

From: Leon Mergen (leon_at_[hidden])
Date: 2006-10-14 06:02:02


Hello,

I'm using GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9), and
the time_duration class was generating the following warning for me:

/usr/local/include/boost/boost/date_time/time_duration.hpp:58: warning:
control may reach end of non-void function

I've heard that I wasn't the first person with this problem, and well,
since I like my code to compile clean (treat warnings as errors), this
was preventing me to do so.

Apparently GCC had some troubles with seeing that the static tick_type
to_tick_count () function defined at time_resolution_traits.hpp was
always returning something. Simply moving the code inside the else {}
block to the end of the function made GCC confident that the function
was indeed always returning something. Looks more like a GCC bug, but
here's the patch:

root_at_solatis1:/usr/local/include/boost/boost/date_time# diff
time_resolution_traits.hpp time_resolution_traits.hpp~
123,125c123,127
< return (((fractional_seconds_type(hours)*3600)
< + (fractional_seconds_type(minutes)*60)
< + seconds)*res_adjust()) + fs;

---
 >       else{
 >         return (((fractional_seconds_type(hours)*3600)
 >                  + (fractional_seconds_type(minutes)*60)
 >                  + seconds)*res_adjust()) + fs;
 >       }
root_at_solatis1:/usr/local/include/boost/boost/date_time#
This is for boost 1.33.1
Regards,
Leon Mergen
http://www.solatis.com



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net