title: What are the difference and use-cases for va_list, CVaListPointer, AnyObject ..., CVarArgType?
body: <p><strong>Question</strong></p>
  
  <p>Can someone please explain the differences between these argument types? Furthermore, if possible please supply appropriate use-cases using code (it's worth a 1000 words). </p>
  
  <p><strong>Nota bene</strong></p>
  
  <p>Please let me know in the comments if there is any requirement for more information.</p>
  
  <p><strong>Background</strong></p>
  
  <p>I am attempting to understand any differences between the following constructs and understand the appropriate use-cases (with examples if there are any). I've searched SO, Google, et, al. (blogosphere) without finding a satisfactory answer.</p>
  
  <p>In writing a data store object, I came across the following initializers for an NSPredicate:</p>
  
  <p><img src="https://i.stack.imgur.com/fMdVn.png" alt="NSPredicate-initializers"></p>
  
  <p>The Swift header file (1.2) notes:</p>
  
  <p><img src="https://i.stack.imgur.com/j4zyt.png" alt="CVaListPointer"></p>
  
  <p>A blog comment indicates the following usage of va_list in Objective-C</p>
  
  <pre><code>+ (void) log:(NSString *) format arguments:(va_list) argList
  {
      [self logString: [NSString stringWithFormat: format arguments:
  argList]];
  }
  
  + (void) log:(NSString *) format, ...
  {
      va_list argList;
      va_start(argList, format);
      {
    [self log: format arguments: argList];
      }
      va_end(argList);
  }
  </code></pre>
  
  <p>CVarArgType is a protocol and can be used as follows according to the Swift header file.</p>
  
  <p><img src="https://i.stack.imgur.com/cgsBG.png" alt="CVarArgType"></p>
  
  <p>In my custom class I have the following use-case:</p>
  
  <pre><code>   /*  Finds an array of entity in the MOC if any exists using an optional
      *   predicate with an array of arguments
      *
      *   Usage:
      *   eg. var items = CustomEntity.findInStore(dbStore, predicate:
      *   NSPredicate(format: "(attributeName IN %@)", argumentArray:
      *   ["value1","value2","value3"])) as? [CustomEntity]
      */
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Readers please note that the argumentArray parameter was incorrectly used as described in my custom class. To correctly use this initializer, note the following from Apple's documentation:</p>
  
  <p><img src="https://i.stack.imgur.com/w2ftz.png" alt="argumentArray-doc"> </p>
  
  <p>Which leads me to this usage:</p>
  
  <pre><code>NSPredicate(format: "(%K != %@ AND %K = %@)", argumentArray: ["key1","value1","key2","value2"]) 
  </code></pre>