Is there any real reason to use "const"?
    Ali Çehreli 
    acehreli at yahoo.com
       
    Mon Jan 24 17:30:26 UTC 2022
    
    
  
On 1/24/22 04:31, Dennis wrote:
 > I never understood the idea of people always including {} braces in
 > if-statements and for-loops.
[...]
 > What idiot would write something like that,
Yeah, that thought disappears once one realizes that humans are 
mistake-making machines. :)
 > One day I had a single-line for-loop
 > body, and to fix an error I quickly added an `import` statement above
 > it, pushing the for-loop body outside the for-loop scope. Oops.
I've done its counterpart just two days ago by commenting out one line 
(in somebody else's code):
   foreach(i; 0..2)
     // foo();
   bar();
Oops! Now bar() is executed multiple times.
I am saddened with this skipped-braces "optimization" because all that 
risk for just to skip writing two characters! Wow! Now... that's... 
interesting... :) Humans are really interesting...
Ali
    
    
More information about the Digitalmars-d
mailing list