Re: [Flightgear-devel] Chasing warnings...
Torsten Dreyer wrote: While iterating through the source files, trying to eliminate the warnings, I just found this precious line of code (some more of them in the same file) *((float*)buf[length]) = sg_bswap_32(*(uint32_t*)val); The beauty of pointers - poor Java, C# et al developers. You will never see something alike ;-) Torsten The worst thing about that line is that it is broken :) The fix is checked in. I used to think that a lot of the warnings produced by -Wall were stupid, but I'm now convinced that we should make -Wall -Werror the default for gcc. Tim -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Chasing warnings...
Tim Moore wrote: The worst thing about that line is that it is broken :) I can't find anything about it that makes it 'broken', knowing that doubles are 64-bit and floats are 32-bit. It might be a bit better this way though. Erik -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Chasing warnings...
On Tue, 25 Aug 2009, Erik Hofman wrote: Tim Moore wrote: The worst thing about that line is that it is broken :) I can't find anything about it that makes it 'broken', knowing that doubles are 64-bit and floats are 32-bit. It might be a bit better this way though. The line: *((float*)buf[length]) = sg_bswap_32(*(uint32_t*)val); Unless I'm mistaken the line writes a uint_32 (supposedly containing a byte-swapped float) to a float location, triggering a automatic value conversion from uint32 to float. Hmm.. and in addition to that val is a double so I would worry that *(uint32_t*)val in fact only gives you the uint32_t value of the first half of the double. Time to fetch the C LRM. Thanks to Tim for noticing this. Cheers, Anders -- --- Anders Gidenstam WWW: http://www.gidenstam.org/FlightGear/ -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Chasing warnings...
Anders Gidenstam wrote: On Tue, 25 Aug 2009, Erik Hofman wrote: Tim Moore wrote: The worst thing about that line is that it is broken :) I can't find anything about it that makes it 'broken', knowing that doubles are 64-bit and floats are 32-bit. It might be a bit better this way though. The line: *((float*)buf[length]) = sg_bswap_32(*(uint32_t*)val); Unless I'm mistaken the line writes a uint_32 (supposedly containing a byte-swapped float) to a float location, triggering a automatic value conversion from uint32 to float. Hmm.. and in addition to that val is a double Hm, that was only obvious after reading the source. I had another part of the code in mind. Good catch indeed. Erik -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[Flightgear-devel] Chasing warnings...
While iterating through the source files, trying to eliminate the warnings, I just found this precious line of code (some more of them in the same file) *((float*)buf[length]) = sg_bswap_32(*(uint32_t*)val); The beauty of pointers - poor Java, C# et al developers. You will never see something alike ;-) Torsten -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Chasing warnings...
Yeah, but just try byte swapping in visual basic ... it can be done! Thanks for the warning clean up pass, it's very much appreciated! Curt. On Fri, Aug 21, 2009 at 4:45 PM, Torsten Dreyer wrote: While iterating through the source files, trying to eliminate the warnings, I just found this precious line of code (some more of them in the same file) *((float*)buf[length]) = sg_bswap_32(*(uint32_t*)val); The beauty of pointers - poor Java, C# et al developers. You will never see something alike ;-) Torsten -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Curtis Olson: http://baron.flightgear.org/~curt/ -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel