title: How to avoid the (potential) error by conversion when assigning a char to a char with ternary operator
body: <p>I have the following Code:</p>
  <pre><code>void foo(char* char_ptr, unsigned short len) {
      char c = len != 0 ? char_ptr[0] : '\0';
      printf(&quot;%c&quot;, c);
  }
  </code></pre>
  <p>I get the following warning:</p>
  <blockquote>
  <p>Clang-Tidy: Narrowing conversion from 'int' to signed type 'char' is implementation-defined</p>
  </blockquote>
  <p>What conversion is this thing talking about? I have only <code>char</code>s everywhere. How can I avoid this (potential) error?
  This looks like another case of &quot;There's some implicit magic going on that you just have to know about&quot;. Is there a place where I can lookup all the magic that the c-compiler is implicitly doing?</p>