Boost logo

Boost :

Subject: Re: [boost] [date_time, Boost 1.40.0]
From: Christoph Duelli (duelli_at_[hidden])
Date: 2009-09-03 06:08:27


Vladimir Prus wrote:

> Andrey Semashev wrote:
>
>> Christoph Duelli wrote:
>>> Andrey Semashev wrote:
>>>
>>>> What warnings?
>>> These:
>>>
>>> boost_1_40_0/include/boost/date_time/gregorian/conversion.hpp:44:
>>> warning: missing initializer for member 'tm::tm_sec'
>>> boost_1_40_0/include/boost/date_time/gregorian/conversion.hpp:44:
>>> warning: missing initializer for member 'tm::tm_min'
>>
>> Looks like GCC is overreacting. Omitting initializers is fine since
>> these members should be initialized to zero.
>
> Would not {0}, as opposed to {}, be enough to remove the warning? Just
> guessing ;-)
No. That makes g++ happy about the first member (tm::tm_sec) and leaves it
complaining about the rest.
If you want the code to compile for different tm struct definitions (more
members...) you either have to leave the code as it is (and maybe tell the
compiler to shut up), or replace it by a memset (little performance penalty
compared to ={}, I guess.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk