gcc warning: braces around scalar initializer

You should remove the braces: { and } around single values. struct TECH lut_model_1[2] = {{296.001465, 74.216972, 2.025908, 1.516384, 1, {0.001746, 0.000256, 0.006216, 0.005249, -0.001668, -0.001377, 0.009865, 0.010454, -0.000288, -0.005853, 0.010584, 0.015440, 0.000465, -0.000602, 0.004330, 0.005700, 0.017120, 0.233015, 0.034154, 0.244022, 0.007644, 0.385683, 0.042960, 0.406633, -0.007811, 0.346931, 0.040123, 0.387361, 0.007030, 0.225309, 0.017897, 0.241024, 0.003700, 0.103601, 0.060748, … Read more

What’s a proper way of type-punning a float to an int and vice-versa?

Forget casts. Use memcpy. float xhalf = 0.5f*x; uint32_t i; assert(sizeof(x) == sizeof(i)); std::memcpy(&i, &x, sizeof(i)); i = 0x5f375a86 – (i>>1); std::memcpy(&x, &i, sizeof(i)); x = x*(1.5f – xhalf*x*x); return x; The original code tries to initialize the int32_t by first accessing the float object through an int32_t pointer, which is where the rules are … Read more

std::unique_ptr of base class holding reference of derived class does not show warning in gcc compiler while naked pointer shows it. Why?

Well, first of all, deleting a derived object through a base pointer when the base class does not have a virtual destructor is undefined behavior. Compilers are not required to diagnose undefined behavior… That being said, the reason why this warning does not appear when using std::unique_ptr is most likely due to the fact that … Read more

How can I make this GCC warning an error?

I’m not sure what the correct warning is, but once you’ve found it, you can change its disposition with the following (using ‘format’ as the example): #pragma GCC diagnostic error “-Wformat” Or as strager points out: gcc -Werror=format … I’ve checked the gcc source for this and this specific warning cannot be disabled via command … Read more

techhipbettruvabetnorabahisbahis forumuedusedusedueduedusedusedusedueduedu