kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

64bit portability issue #626

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Function 'int index() const' in class of 'Descriptor' @ descriptor.h
  should change the return type from int to ptrdiff_t

What is the expected output? What do you see instead?
   the code should compile with no error for 64bit platform
   On 64bit platform, the function 'index()' mentioned, convert a pointer to int this will lead to unknown result, because pointer is 64bit but int is 32bit.

What version of the product are you using? On what operating system?
   2.5.0

Please provide any additional information below.

Original issue reported on code.google.com by nio...@gmail.com on 2 Apr 2014 at 1:44

GoogleCodeExporter commented 9 years ago
What's the compile error? I think we can and a static_cast to suppress the 
error message. There is no chance the index can be larger than 32bit.

Original comment by xiaof...@google.com on 2 Apr 2014 at 8:11

GoogleCodeExporter commented 9 years ago
'return' conversion from '__int64' to 'Int' possible lose of data.
run the app on 64bit os lead app crash.

Original comment by nio...@gmail.com on 3 Apr 2014 at 1:01