[PATCH 2/2] Profile2: use an implicit initializer for a struct array

Lubomir I. Ivanov neolit123 at gmail.com
Mon Mar 10 09:27:28 PDT 2014


On 10 March 2014 18:24, Dirk Hohndel <dirk at hohndel.org> wrote:
>> @@ -229,7 +229,7 @@ void DiveHeartrateItem::modelDataChanged(const QModelIndex &topLeft, const QMode
>>       struct {
>>               int sec;
>>               int hr;
>> -     } hist[3] = { 0 };
>> +     } hist[3] = {};
>
> I'll ask our resident compiler and language standards guru (Thiago) to
> chime in here. I thought that the ISO standard requires the initializer
> to be non-empty and that the '{}' initializer was a gcc-ism.
>

not so long ago anton did a similar patch from a clang warning.
as an alternative in that particular case we can also use the double braces:

.. = {{ 0 }};

lubomir
--


More information about the subsurface mailing list