[cleanup patch] Integer type usage in dataobj/einstellungen.h June 18, 2010, 08:21:21 pm There are a number of unnecessary integer widening/shortenings going on which cause warnings with -Wconversion on recent GCC. This eliminates some of them by using the correct type in set_ and get_ operations. I updated and clarified some comments while I was at it.I'm hoping to eventually be able to turn -Wconversion on permanently, as it warns about all kinds of dangerous data-losing operations, but it gives way too many warnings so far, so I'm having to clean them up a few at a time. Quote Selected
Re: [cleanup patch] Integer type usage in dataobj/einstellungen.h Reply #1 – June 18, 2010, 09:24:11 pm why casting (uint8)0 0u should also create an unsigned zero. (But since zero is unsigned anyway, this seems rather stupid of the compiler.) Quote Selected
Re: [cleanup patch] Integer type usage in dataobj/einstellungen.h Reply #2 – June 19, 2010, 05:18:51 am Quote from: prissi – on June 18, 2010, 09:24:11 pmwhy casting (uint8)0 0u should also create an unsigned zero. (But since zero is unsigned anyway, this seems rather stupid of the compiler.)It is rather stupid of the compiler. This seemed to be the reliable way to prevent it from warning that I was narrowing an integer (32-bit zero versus 8-bit zero!). It should be smart enough to know that that is safe, but it seemed to be having trouble. Quote Selected