---------------
Christof.Meerwald@ freec++.prog

home
> prog
>> freecpp
>>> empty base opt

translate to German (by SYSTRAN)

Empty Base Class Optimization

see The "Empty Member" C++ Optimization.

> empty_base_opt.cpp:

struct A
{ };

struct B
  : public A
{
  int i;
};


int main(int argc, char *argv[])
{
  B b;

  return !(static_cast<void *>(&b) == static_cast<void *>(&b.i));
}
---------------

This Web page is licensed under the Creative Commons Attribution - NonCommercial - Share Alike License. Any use is subject to the Privacy Policy.

Revision: 1.3, http://cmeerw.org/prog/freecpp/empty_base_opt.html
Last modified: Sun Jan 13 23:54:37 2002
Christof Meerwald <cmeerw@cmeerw.org>
XMPP: cmeerw@cmeerw.org