gcc4 warnings -Wuninitialized -Wfloat-equal and -Wconversion

Jaime jtamate at gmail.com
Wed Sep 23 08:48:23 BST 2009


2009/9/23 Thiago Macieira <thiago at kde.org>:
> Em Terça-feira 22. Setembro 2009, às 22.18.08, Jaime Torres escreveu:
>> using a struct like this:
>>
>> typedef enum {
>>         LeftToRight,
>>         RightToLeft
>> } LayoutDirection_T;
>>
>> typedef struct
>> {
>>         LayoutDirection_T b:1;
>> }
>> LayoutDirection;
>>
>> test2.cpp compiles cleanly.
>>
>
> How do you plan on placing a value inside that struct?
>
> Are you going to define a constructor, like this?
>
>    LayoutDirection(uint val) : b(val) {}
>
> Won't that generate the same warning?

Good point.
Let's assume then that it is done right (do not use -Wconversion)
until the compiler generates the good warnings for the bitfields. But
I'll use it from time to time to reduce the warnings in non bitfields.

Best Regards.




More information about the kde-core-devel mailing list