On Wed, Jul 2, 2014, at 07:06 AM, Christoffer Holmstedt wrote:
Interesting problem. Concerning readability of floating point numbers, for me personally "4.0" is better than just "4.". Is this just personal preference or is there any benefit of just "4."?
 
A quick search for "float" on inkscape coding style page didn't show anything.
 
 
 
I was thinking exactly the same thing. Sure, dropping the '0' leaves for fewer characters to type, but it makes the decimal much harder to spot. Legibility helps with maintenance and with spotting bugs, so it's generally a good idea to make things more legible. Among other things, think of decimal calculations in a parameter list "3 * 4., 5 *3". When next to a comma it will really hide on some systems. Much harder for the human eye to catch in casual scanning.
 
That goes along with parenthesis. Technically they are often not required... however making them explicit helps the poor humans who have to read the code. It's such a good practice that when Java was being designed, that suggestion (add parenthesis even when not required by the language) was actually included in the Java language spec itself. And think... that was for a language that does not have all the ambiguity that C/C++ has.
 
--
Jon A. Cruz
jon@...18...