While I doubt that - in practice - a compiler would generate incorrect code in 
this case, I agree that it's a possibility unless we compile with 
"-fno-strict-aliasing".  But I don't want to do that, because it could make the 
whole of the code less efficient.  (And changing the Makefiles to compile only 
this one file - "MatroskaFileParser.cpp" - with that flag would be messy.)

However, reading through some of the comments at the bottom of 
<http://labs.qt.nokia.com/2011/06/10/type-punning-and-strict-aliasing/>, it's 
noted that   one can get around strict aliasing restrictions by using 
"memcpy()".  So, with this in mind, try the following alternative 
implementation of "MatroskaFileParser::parseEBMLVal_float()", and let us know 
if it makes your compiler happy:


Boolean MatroskaFileParser::parseEBMLVal_float(EBMLDataSize& size, float& 
result) {
  unsigned resultAsUnsigned;
  if (!parseEBMLVal_unsigned(size, resultAsUnsigned)) return False;

  if (sizeof result != sizeof resultAsUnsigned) return False;
  memcpy(&result, &resultAsUnsigned, sizeof result);
  return True;
}


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to