astitcher commented on pull request #295:
URL: https://github.com/apache/qpid-proton/pull/295#issuecomment-776919020


   > you definitely know better.
   > tell me why you think that the difference is guaranteed to be less than 
`MAX_UINT/2`?
   
   TBH, it's probably not absolutely guaranteed, but it would be an extremely 
large number of queued up messages (2 billion or so). Whereas the wrap-around 
will always happen after processing 4 billion or so messages. Do you see the 
difference? In other words the wrap around is guaranteed to happen if the 
system stays up long enough to process 4 billion messages, but we only require 
that the queued messages to be fewer than 2 billion or so - we probably don't 
have nearly enough memory to hold that many queud messages!
   
   However in the case of this code it turns out that it is actually already 
correct even in the case where the difference is not guaranteed - thank you for 
making me think carefully about it. It's just unclearly written and probably 
correct by accident!
   
   > 
   > additionally, I note that in my opinion `hwm-lwm>0&&hwm-lwm<0x8000` is 
equivalent to `hwm>lwm`
   
   Hmm, not really true (I don't see how it can be an opinion!): For example:
   
   ```
   uint16_t lwm = 0xfffe;
   uint16_t hwm = 0x0003;
   ```
   
   `hwm>lwm == false`
   `hwm-lwm>0&&hwm-lwm<0x8000 == true`
   
   But in the context of our tests we want the second outcome not the first.
   
   > 
   > but in any case, you know better, so tell me what to do next with this PR.
   
   Well, as we've seen there actually isn't a bug here in the first place. But, 
if you are desperate to change code and not to accept the code I suggest you 
could change it to simply: `lwm != hwm` which is the current effect of the 
code, and is correct although a little brittle if other code changes.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to