<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div>In liveMedia/RTSPServer.cpp, on line 1252, there's a multi clause if<br>statement that, as formatted, looks like you want it to be evaluated in a<br>way that precedence rules say you will get a surprise.<br><br>The line looks like this:<br>if (streamingMode == RTP_TCP && rtpChannelId == 0xFF ||<br> streamingMode != RTP_TCP && ourClientConnection->fClientOutputSocket<br>!= ourClientConnection->fClientInputSocket) {...}<br><br>It looks like you expect it to be evaluated like this:<br>if ((streamingMode == RTP_TCP && rtpChannelId == 0xFF || streamingMode !=<br>RTP_TCP) && (ourClientConnection->fClientOutputSocket !=<br>ourClientConnection->fClientInputSocket)) {...}<br><br>The compiler will actually give you this:<br>if ((streamingMode == RTP_TCP && rtpChannelId == 0xFF) || (streamingMode<br>!= RTP_TCP && ourClientConnection->fClientOutputSocket !=<br>ourClientConnection->fClientInputSocket)) {...}<br><br>because && has slightly higher precedence than ||.<br></div></blockquote><div><br></div>This (the latter interpretation) is actually what I wanted - so the code is not in error. However, I'll add parentheses to the code, to make the meaning clearer.</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>