Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Coding style conformance

...

Code Block
bgColor#ccccff
langcpp
#include <cstddef>

struct D {
  virtual void f() {}
  struct InnerStandardLayout {
    int i;
  } Innerinner;
};

void f() {
  size_t off = offsetof(D::InnerStandardLayout, i);
  // ...
}

...

The noncompliant code example does not emit a diagnostic when compiled with the /Wall switch in Microsoft Visual Studio 2013 2015 on x86, resulting in off being a large value, likely representing the offset between the null pointer address 0 and the address of the static variable S::i.

...