I am getting the following run-time check failure in coded_stream.h at
the following function:

inline uint8* CodedOutputStream::WriteLittleEndian32ToArray(uint32
target) {
    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
  memcpy(target, &value, sizeof(value));
  target[0] = static_cast<uint8>(value);   ////////////////////////
This is where the error hits.
  target[1] = static_cast<uint8>(value >>  8);
  target[2] = static_cast<uint8>(value >> 16);
  target[3] = static_cast<uint8>(value >> 24);
  return target + sizeof(value);

Visual Studio Error:
Run-Time Check Failure #1 - A cast to a smaller data type has caused a
loss of data. If this was intentional, you should mask the source of
the cast with the appropriate bitmask. For example:
    char c = (i & 0xFF);
Changing the code in this way will not affect the quality of the
resulting optimized code.

Has anyone seen this? Did I do something wrong or is this something
that needs to change in the library? I think--but have not yet
verified--that I can disable this when compiling the protocol buffer

Screenshot here:

This post is similar to the problem I'm having:

Thank you,


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to