title: In Objective-c, safe and good way to compare 2 BOOL values?
body: <p>I want to compare 2 BOOL values in objective-c.</p>
  
  <p>I found out that (3)-(6) of the following code works.<br>
  (1)-(2) doesn't work because BOOL is just <code>signed char</code>.</p>
  
  <p>(3) works and is very readable but I think <code>bool</code> isn't objective-c.<br>
  Using <code>bool</code> in objective-c code is good?</p>
  
  <p>Which is the safe and good way to compare 2 BOOL values in objective-c?<br>
  Are there other better ways to compare?</p>
  
  <pre><code>BOOL b = YES;
  BOOL c = 2;
  
  NSLog(@"(1) %d", b == c); // not work
  NSLog(@"(2) %d", (BOOL)b == (BOOL)c); // not work
  NSLog(@"(3) %d", (bool)b == (bool)c);
  NSLog(@"(4) %d", !b == !c);
  NSLog(@"(5) %d", !!b == !!c);
  NSLog(@"(6) %d", (b != 0) == (c != 0));
  </code></pre>
  
  <p>results:</p>
  
  <pre><code>(1) 0
  (2) 0
  (3) 1
  (4) 1
  (5) 1
  (6) 1
  </code></pre>