GNOME Bugzilla – Bug 424897
Bad code generated for double constants by sfidl
Last modified: 2007-07-02 12:04:04 UTC
For the following idl file: record RealDivision { // computation result should be 3.14 Sfi::Real pi = ("PI", "", 314.0 / 100.0, 3, 4, 0.1, ":readwrite"); }; sfidl generates code (namely 314 / 100) so that the default for pi will become 3, instead of 3.14. This needs to be fixed for porting the DavOrgan module to C++.
Created attachment 85613 [details] [review] Fix for bad code generation This adds a testcase and fixes the problem (by using %e instead of %g for formatting doubles). For details see the ChangeLog included in the patch.
Note: this patch is an improved version of the one discussed on the list in December: http://mail.gnome.org/archives/beast/2006-December/msg00008.html
Created attachment 86112 [details] [review] New, improved fix for bad code generatioon Improved based on comments from IRC review by Tim Janik.
thanks the new patch looks good. and assuming it's tested (you added testcases after all, very good) it can go in. except for the fact that we should use String (Birnet::String) instead of std::string in our code, so that still needs to be fixed.
I committed things now, so the sfidl bug is fixed in r4329 are in, and the std::string -> Birnet::String is fixed separately in r4331.