* Rafal Dabrowa:
Suppose we have the following structure:
struct foo {
int x, y;
};
Is there a possibility to get sizeof(foo::x) when
no variable of type foo is available ?
A common hack is
foo fooObject(); // Not implemented.
std::size_t const s = sizeof( fooObject().x );
If you like to live dangerously you can alternatively just
cast 0 to a pointer to foo and dereference it, but although
it should be practically safe (sizeof arguments aren't evaluated
at run time) I'm not sure about its formal legality: if it were
all OK then presumably the hack above would be less used.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?