> In liveMedia/RTSPServer.cpp, on line 1252, there's a multi clause if
> statement that, as formatted, looks like you want it to be evaluated in a
> way that precedence rules say you will get a surprise.
>
> The line looks like this:
> if (streamingMode == RTP_TCP && rtpChannelId == 0xFF ||
> streamingMode != RTP_TCP && ourClientConnection->fClientOutputSocket
> != ourClientConnection->fClientInputSocket) {...}
>
> It looks like you expect it to be evaluated like this:
> if ((streamingMode == RTP_TCP && rtpChannelId == 0xFF || streamingMode !=
> RTP_TCP) && (ourClientConnection->fClientOutputSocket !=
> ourClientConnection->fClientInputSocket)) {...}
>
> The compiler will actually give you this:
> if ((streamingMode == RTP_TCP && rtpChannelId == 0xFF) || (streamingMode
> != RTP_TCP && ourClientConnection->fClientOutputSocket !=
> ourClientConnection->fClientInputSocket)) {...}
>
> because && has slightly higher precedence than ||.
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.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel