To use an IDL keyword as an identifier, the keyword must be “escaped” by prepending an underscore, ‘_’. In addition, you must run RTI Code Generator with the -enableEscapeChar option. For example:
struct MyStruct { octet _octet; // octet is a keyword. To use the type // as a member name we add ‘_’ };
The use of ‘_’ is a purely lexical convention that turns off keyword checking. The generated code will not contain ‘_’. For example, the mapping to C would be as follows:
struct MyStruct { unsigned char octet; };
Note: If you generate code from an IDL file to a language ‘X’ (for example, C++), the keywords of this language cannot be used as IDL identifiers, even if they are escaped. For example:
struct MyStruct { long int; // error long _int; // error };
© 2015 RTI