title: C++ function with any parameters make Segmentation fault
body: <p>Here is my program, anyone know why?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;stdarg.h&gt;
  using namespace std;
  
  void say(char* name ...)
  {
      cout &lt;&lt; "Hello, ";
      cout &lt;&lt; name ;
      va_list ap;
      va_start(ap,name);
  
      for(;;){
          char* str = va_arg(ap, char*);
          if (str == 0) break;
          cout &lt;&lt; ", " &lt;&lt; str;
      }
      cout &lt;&lt; endl;
      va_end(ap);
  }
  int main()
  {
      char *a = "atom";
      char *b = "johhny";
      char *c = "jim";
      say(a,b,c);
  }
  </code></pre>
  
  <p>When I run it, I got this:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  0x0000003f0b06fed0 in strlen () from /lib64/tls/libc.so.6
  </code></pre>
  
  <p>Here is the debug info:</p>
  
  <pre><code>24      cout &lt;&lt; "Hello, ";
  (gdb) n
  25      cout &lt;&lt; name ;
  (gdb) n
  27      va_start(ap,name);
  (gdb) n
  30          char* str = va_arg(ap, char*);
  (gdb) n
  31          if (str == 0) break;
  (gdb) n
  32          cout &lt;&lt; ", " &lt;&lt; str;
  (gdb) n
  29      for(;;){
  (gdb) n
  30          char* str = va_arg(ap, char*);
  (gdb) n
  31          if (str == 0) break;
  (gdb) n
  32          cout &lt;&lt; ", " &lt;&lt; str;
  (gdb) n
  29      for(;;){
  (gdb) n
  30          char* str = va_arg(ap, char*);
  (gdb) n
  31          if (str == 0) break;
  (gdb) n
  32          cout &lt;&lt; ", " &lt;&lt; str;
  (gdb) n
  
  Program received signal SIGSEGV, Segmentation fault.
  0x0000003f0b06fed0 in strlen () from /lib64/tls/libc.so.6
  (gdb) n
  Single stepping until exit from function strlen,
  which has no line number information.
  
  Program terminated with signal SIGSEGV, Segmentation fault.
  The program no longer exists.
  </code></pre>