title: C++ pointer arithmetic: alignment exception (0x801)
body: <p>I got a very strange alignment exception, which only occurs on certain hardware combinations.
  I have implemented a bluetooth audio sink, which get its data fed from a unix file descriptor. When i combine a Macbook Pro (as bluetooth source) and a raspberry pi (as bluetooth sink), i get an alignment exception at the following point:</p>
  
  <pre><code>void process(uint8_t* inData, uint32_t size, float* outData)
  {
      int16_t* from = (int16_t*)inData;
      float* to = outData;
  
      for (size_t i = 0; i &lt; size/2; ++i) {
          *to = *from/32767.0;
          ++to;
          ++from; // Crashes on MacbookPro/RasPi combination
      }
  }
  </code></pre>
  
  <p>How comes? My sink obviously does not know about my source. And this works for other platforms (combinations)?</p>
  
  <p>I also tried this snippet, however, also no success.</p>
  
  <pre><code>int8_t* from = (int8_t*)inData;
  float* to = outData;
  
  for (size_t i = 0; i &lt; size/2; ++i) {
      int16_t tmp;
      std::memcpy(&amp;tmp, from, 2);
      *to = tmp/32767.0;
      ++to;
      from += 2; // This crashes
  }
  
  </code></pre>
  
  <p>I guess a running example would not help here, since the exact same code works, when using another data (bluetooth) source.</p>