[PATCH] [sim,rx] Silence warning that turns into a build error

Luis Machado luis.machado@linaro.org
Fri Apr 9 12:17:11 GMT 2021


On 4/8/21 5:57 PM, Mike Frysinger wrote:
> On 08 Apr 2021 17:23, Luis Machado via Gdb-patches wrote:
>> On 4/8/21 5:16 PM, Mike Frysinger wrote:
>>> On 08 Apr 2021 16:51, Luis Machado via Gdb-patches wrote:
>>>> +  FP_Parts a = {0, 0, 0, 0, 0};
>>>
>>> wouldn't it be simpler & equiv:
>>> 	FP_Parts a = {};
>>
>> I find that it works, but I'm unsure if it is a standard way of doing it.
>>
>> The C reference says:
>>
>> "When initializing an object of struct or union type, the initializer
>> must be a non-empty, brace-enclosed, comma-separated list of
>> initializers for the members."
>>
>> So I went with the most obvious, as opposed to going shorter and more
>> opaque.
> 
> my concern is more about having to tweak this whenever fields are added
> or removed.
> 
> i couldn't remember if the ={} syntax was a C++ extension, or in C11.
> if it's a C++ extension, i *think* ={0} will work even in C11.
> -mike
> 

I think it is a C++ thing. I pushed it with the {0} initializer now.


More information about the Gdb-patches mailing list