Boost logo

Boost Users :

Subject: [Boost-users] left shift count >= width of type
From: Maróy Ákos (akos_at_[hidden])
Date: 2009-07-31 07:34:27


Hi,

In boost-1_39/boost/date_time/filetime_functions.hpp at line 101 I
always get the following warning when using gcc 3 with mingw:

boost-1_39/boost/date_time/filetime_functions.hpp:101: warning: left
shift count >= width of type

can this be averted somehow?

interestingly, if I add the above code in a simple function, no warning
occurs. but, if I add the above code into a function template (as it is
in the boost include file), I do get the warning. so something like:

     template< typename T >
     void foo() {
         /* shift is difference between 1970-Jan-01 & 1601-Jan-01
         * in 100-nanosecond intervals */
         const uint64_t c1 = 27111902UL;
         const uint64_t c2 = 3577643008UL; // issues warning without 'UL'
         const uint64_t shift = (c1 << 32) + c2;
     }

will result in a warning, without the template, it does not.

Akos


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