chengxxxxwang / metasyntactic

Automatically exported from code.google.com/p/metasyntactic
Apache License 2.0
0 stars 0 forks source link

fixed64 is mapped to 'int64_t', should it be 'uint64_t'? #129

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Given the input:

message Guid {
  optional fixed64 lo = 1; // the first 8 bytes of the guid
  optional fixed64 hi = 2; // the second 8 bytes of the guid
}

protoc for objective-c generates:

@interface Guid : PBGeneratedMessage {
@private
  BOOL hasLo_:1;
  BOOL hasHi_:1;
  int64_t lo;
  int64_t hi;
}
- (BOOL) hasLo;
- (BOOL) hasHi;
@property (readonly) int64_t lo;
@property (readonly) int64_t hi;
....

I'd have expected the uint64_t type to be used, as fixed64 appears to
unsigned, with sfixed64 being the signed variant?

Using build 2.2.0 of ProtocolBuffers on Mac OS X Snow Leopard.

Joseph Heenan
joseph@heenan.me.uk

Original issue reported on code.google.com by joseph.j...@gmail.com on 12 May 2010 at 11:40

GoogleCodeExporter commented 8 years ago
Hey Jospeh.  The Obj-C implementation follows the Java implementation (which 
made it 
both easy to port and easy to maintain).  As java doesn't have unsigned types, 
it 
uses signed types in these cases.  So we do the same in Obj-C. 

There is a 1:1 mapping though of all uint_64s to int64s.  So you can always 
transliterate the values yourself.

Original comment by cyrus.na...@gmail.com on 12 May 2010 at 7:15

GoogleCodeExporter commented 8 years ago
Hi Cyrus,

Ah, I see - thanks. At least I know I've understood correctly :)

Joseph

Original comment by joseph.j...@gmail.com on 15 May 2010 at 8:24

GoogleCodeExporter commented 8 years ago

Original comment by cyrus.na...@gmail.com on 2 Nov 2010 at 5:23