Open main menu

CDOT Wiki β

Changes

Researching XPIDL and IDL Technologies

388 bytes added, 16:22, 5 October 2006
Enumerations and Constants
C-style enumerations are not supported in XPIDL because the size of enums can be compiler specific. XPIDL alternatively supports defining constants that appear in the C++ and JavaScript mappings. They must be of type short or long and have to be present inside an interface declaration.
Other types are not supported because they do not map into all languages or have memory management issues. To define a constant that is neither short or long, write a method that returns the value, or include the value in an attribute.
 
XPIDL Code C++ Code
const short c1 = 1+1; enum { c1 = 2 };
const short c2 = c1 * 5; enum { c2 = 10 };
const long flag = 1 << 5; enum { flag = 32 };
const float invalid_constant = 6.0; Warning: const decl 'invalid_constant' was not of type short or long, ignored
1
edit