On 1/26/2010 1:03 AM, Boris Kolpackov wrote:
Hi David,

David Bertoni<[email protected]>  writes:

const_cast<BinHTTPInputStreamCommon*>(this)->fContentType =
const_cast<BinHTTPInputStreamCommon*>(this)->findHeader("Content-Type");

I have made this change for the upcoming 3.1.0.
Great!

We really should just make this data member mutable, since the code as
it stands results in undefined behavior.

Agree about mutable, though it is not used anywhere in the code base
yet. As for the undefined behavior, it will only be the case if someone
creates a const BinHTTPInputStreamCommon object, which is very unlikely
to happen.
Sorry, I should have been more specific. I just don't like seeing a 10+ year-old idiom to work around the missing "mutable" keyword.

Do we really think there are compilers out there that don't support the "mutable" keyword that are still in use? At some point we have to leave the past behind, and it would certainly make the code cleaner to allow this keyword.

Dave

Reply via email to