---------------
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.4, cmeerw.org/prog/freecpp/empty_base_opt.html
Last modified: Mon Sep 03 18:20:50 2018
Christof Meerwald <cmeerw@cmeerw.org>
XMPP: cmeerw@cmeerw.org