Changeset 52074 in webkit
- Timestamp:
- Dec 13, 2009 4:14:13 PM (14 years ago)
- Location:
- trunk/WebKitSite
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitSite/ChangeLog
r51932 r52074 1 2009-12-13 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Add a style guideline concerning floating point literals 6 https://bugs.webkit.org/show_bug.cgi?id=32497 7 8 * coding/coding-style.html: 9 1 10 2009-12-09 Marwan Al Jubeh <marwan.aljubeh@gmail.com> 2 11 -
trunk/WebKitSite/coding/coding-style.html
r51929 r52074 422 422 </li> 423 423 <li>In Objective-C, instance variables are initialized to zero automatically. Don't add explicit initializations to nil or NO in an init method.</li> 424 </ol> 425 426 <h3>Floating point literals</h3> 427 <ol> 428 <li>Unless required in order to force floating point math, do not append 429 <code>.0</code>, <code>.f</code> and <code>.0f</code> to floating point 430 literals. 431 432 <h4 class="right">Right:</h4> 433 <pre class="code"> 434 const double duration = 60; 435 436 void setDiameter(float diameter) 437 { 438 radius = diameter / 2; 439 } 440 441 setDiameter(10); 442 443 const int framesPerSecond = 12; 444 double frameDuration = 1.0 / framesPerSecond; 445 </pre> 446 447 <h4 class="wrong">Wrong:</h4> 448 <pre class="code"> 449 const double duration = 60.0; 450 451 void setDiameter(float diameter) 452 { 453 radius = diameter / 2.f; 454 } 455 456 setDiameter(10.f); 457 458 const int framesPerSecond = 12; 459 double frameDuration = 1 / framesPerSecond; // integer division 460 </pre> 461 </li> 424 462 </ol> 425 463
Note: See TracChangeset
for help on using the changeset viewer.