conditions precedence in 'if'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all, 

First consider this: 
bool flag = false; 
while (condition) { 
   ... 
   if ( !flag && ANOTHER_CONDITION ) { 
      .... 
   } 
}
If the "while" loop iterates for 10 times, the both flag and ANOTHER_CONDITION 
are checked 10 times. 


Now consider this: 
bool flag = false; 
while (condition) { 
   ... 
   if ( !flag && ANOTHER_CONDITION ) { 
      .... 
      flag = true; 
   } 
}
If the "while" loop iterates for 10 times and in the first iteration "flag = 
true;" is executed, then how many times, ANOTHER_CONDITION is checked? 1 or 10?

How does GCC-4.1.3 act to condition precedences? 
 
// Naderan *Mahmood;


  



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux