On 03/05/2013 06:47 PM, Christos Zoulas wrote:
As I mentioned before if you change the const variable declaration to a #define, you'll get the warning in all gcc 32 bit platforms (or if you use a gcc circa 4.1 which had code to do the constant folding more aggressively).
Yes, older GCCs are particularly bad about that; if you ask them to warn, they issue all sorts of bogus warnings. So it's better to not ask them to warn. Even newer GCCs mess up sometimes; and even then it's often better to ignore them.
if the code is a no-op on all 32 bit platforms it should probably be improved!
So far, all the suggestions for improvement would complicate the code, which will make it harder for humans to understand. Often in such cases it's better to keep the code simple, and to ignore or disable the bogus warnings.
What I am asking here, is if dayoff is mistyped (long instead of zic_t) and 'long oadd(long, long)' should be 'zic_t oadd(zic_t, long)'.
I'd go further. I expect the zic.c code would benefit by a uniform substitution of int_fast64_t for long -- but one would have to do considerably more than just a simple string substitution.