Why arent Brew APIs designed with C++? | developer.brewmp.com Why arent Brew APIs designed with C++? | developer.brewmp.com

Developer

Why arent Brew APIs designed with C++?

Forums:

As we know :
1, C++ can do the same things as C.
2, All of the Brew interfaces are designed as the following:

struct _AEEApplet
{
//
// NOTE: These 3 fields must be declared in this order!
//
DECLARE_VTBL(IApplet)
AEECLSID clsID;

uint32 m_nRefs; // Applet reference counter
IShell * m_pIShell; // pointer to IShell
IModule * m_pIModule; // pointer to IModule
IDisplay * m_pIDisplay; // pointer to IDisplay

...

They imitate the virtual table of C++...

Then, why not use C++ to design these interfaces?

While most compilers do indeed layout the C++ vtable this way, not all do. The C++ standard allows compilers to do what they want - and the ARM ABI v1 as used by ADS 1.2 used a different vtable arrangement meaning that these interfaces had to be created in C. ARM ABI v2 (used by ADS 2.1 and later) uses the same vtable format as GCC, and these interface can (and have been - see lightblue.tigris.org ) be reimplemented in C++.

While most compilers do indeed layout the C++ vtable this way, not all do. The C++ standard allows compilers to do what they want - and the ARM ABI v1 as used by ADS 1.2 used a different vtable arrangement meaning that these interfaces had to be created in C. ARM ABI v2 (used by ADS 2.1 and later) uses the same vtable format as GCC, and these interface can (and have been - see lightblue.tigris.org ) be reimplemented in C++.