-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix next_message_reader() method #39
base: master
Are you sure you want to change the base?
Conversation
According to the comment, the function must return a valid message (although not necessarily complete). This is logical, but not so now. Also, now, in the absence of a valid message, we will return a zero-size reader pointing to the last byte
Please explain further? How is Honestly, this whole business with automatically searching for the next Users can write their own function to scan through invalid garbage bytes looking for some valid FIX, if they really want to. Which might be a good idea sometimes, like when the user is trying to parse and audit old trading logs. But choosing which kinds of garbage are allowable is very specific to the situation, and this library shouldn't guess about that. |
I agree with you, but I think that this will have to stay at least for the sake of backward compatibility.
|
If there is no valid message in the rest of the buffer, then we don't know where the last byte is. That's why the
This is awkward, but it's pretty common practice in C++. It would be better if we could make this invalid state unrepresentable so that the compiler could verify that we never call |
message_begin and prefix_* does not throw an exception. I still find the change very useful |
According to the comment, the function must return a valid message
(although not necessarily complete). This is logical, but not so now.
Also, now, in the absence of a valid message, we will return a zero-size
reader pointing to the last byte