<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div><blockquote type="cite">complains about the following statement:<br></blockquote><blockquote type="cite">----<br></blockquote><blockquote type="cite">result = *(float*)&resultAsUnsigned;<br></blockquote></div></blockquote><div><br></div>No, this compiler warning message does not indicate a bug in the code.  "resultAsUnsigned"  is a 4-byte value that stores a 'float'; it is not an unsigned value that gets converted to a float.</div><div><br></div><div><blockquote type="cite"><div><blockquote type="cite">This little snippet, and it's compiled output, illustrate the problem:<br></blockquote></div></blockquote><div><br></div>No, a more accurate 'snippet', which illustrates what the code really does, would be:</div><div><br></div><div><div>void func(float &f)</div><div>{</div><div>  float val = 3.0;</div><div>   unsigned *vptr = (unsigned*)&val;</div><div><br></div><div>   unsigned resultAsUnsigned = *vptr; // a 4-byte value that stores a 'float'</div><div>   f = *(float*)&resultAsUnsigned;</div><div>}</div><div><br></div><div>(and then "main()" as you originally wrote it)</div><div><br></div><div>If you can suggest an alternative coding that eliminates your compiler warning, then that would be great.  But the code - as it stands - is not in error.</div></div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>