[Jason, can you pontificate on tail-padding and the upcoming C++ standard with regards to bitfields?]

so you wasn't convinced about my worries about tail-padding re-use?

To answer your question, I believe we can't touch past the last field (into the padding) if the subsequent record will be packed into the first's padding.

struct A {
  int a : 17;
};
struct B : public A {
  char c;
};

So here, if <c> gets packed into the tail-padding of A, we can't touch the padding of A when storing into <a>. These are different structures, and I assume would be treated as nested structures, which are distinct memory locations.

Is there a way of distinguishing this particular variant (possible tail-packing), or will we have to disallow storing into the record tail padding altogether? That would seriously suck.

Aldy

Reply via email to