title: Initialize QByteArray avoiding [-Wnarrowing]
body: <p>I am on an architecture where <code>char</code> is interpreted as <code>signed</code> by default.</p>
  
  <p>I construct a <code>char array</code> similar as mentioned in the <a href="http://doc.qt.io/qt-5/qbytearray.html#fromRawData" rel="nofollow noreferrer">Qt5 documentation for QByteArray</a>:</p>
  
  <pre><code>const char char_buffer[] = {
      0xFF, 0x00, 0x03
  }; 
  </code></pre>
  
  <p>When I later call <code>QByteArray::fromRawData(char_buffer)</code> respectively <code>QByteArray(char_buffer)</code>, the compiler will complain: </p>
  
  <pre><code>error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
  </code></pre>
  
  <p>(There is no <code>unsigned char *</code> parameter overload for <code>fromRawData()</code>)</p>
  
  <h1>Solutions:</h1>
  
  <p>Whenever I have to interact with one of the in-built function, I cast an <code>unsigned char *</code>.</p>
  
  <pre><code>const char uchar_buffer[] = {
      0xFF, 0x00, 0x03
  }; 
  QByteArray::fromRawData(reinterpret_cast&lt;const char*&gt;(uchar_buffer), sizeof(uchar_buffer))
  </code></pre>
  
  <h1>Question:</h1>
  
  <p>Did I oversee any easier/straight forward solution without casting (and keeping the warning for narrowing)?</p>