Unfortunately this doesn't work, as typedefs in Thrift are expected to purely 
be top-level type declarations -- either primitives or containers of primitives:

>From thrifty.yy
Typedef:
  tok_typedef DefinitionType tok_identifier

The main issue is that in C++ we declare all typedefs at the top of the types 
file. This would cause forward declaration problems when typedefs are used for 
user-defined types.

We could definitely fix this by having typedefs generate in the order they 
appear and requiring that typedefs in a .thrift file refer to already-defined 
types. Would take some work re-mangling the code generation order.

-----Original Message-----
From: Anuj Garg [mailto:[email protected]] 
Sent: Monday, March 08, 2010 1:03 AM
To: [email protected]
Subject: Typedef

I can use the following code -

typedef i32 MyInt // correct

can I use like this  ... ???

struct myStruct
{
  int id;
  string value;
}

typedef myStruct myAnotherStruct; // Is it possible... ???
  • Typedef Anuj Garg
    • RE: Typedef Mark Slee

Reply via email to