You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Anait Markosian <am...@lyris.com> on 2011/05/26 22:18:14 UTC

Thrift IDL

 How does one represent in thrift struct :
1 a long integer field?
2. a const int field (equivalent to 'static final int field' in java) ? 

Thanks!

RE: Thrift IDL

Posted by Mark Slee <ms...@fb.com>.
>> 1 a long integer field?

The term "long" is vague, Thrift is explicit. Use i32 for 32-bit integers, i64 for 64-bit integers. You probably want i64.

>> 2. a const int field (equivalent to 'static final int field' in java) ?

Struct fields can't be constants. If you just want to define a symbolic constant for use in your code you can say:

const i32 MY_CONSTANT = 23423;

Or you can just give a field a default-value if you want, but it won't be immutable.

Cheers,
mcslee

-----Original Message-----
From: Anait Markosian [mailto:amarkosian@lyris.com] 
Sent: Thursday, May 26, 2011 1:18 PM
To: user@thrift.apache.org
Subject: Thrift IDL

 How does one represent in thrift struct :
1 a long integer field?
2. a const int field (equivalent to 'static final int field' in java) ? 

Thanks!