I recently came across this code and thought it was a little overkill.
struct Structure {
unsigned int first;
unsigned int last;
};
(std::size_t)&((Structure *)0)->last; // 4
So I'm wondering if I can safely do:
sizeof(unsigned int); // 4
instead of:
(std::size_t)&((Structure *)0)->last; // 4
or what that code is doing anyway if it's so much better.
EDIT
That code more or less euqals to offsetof
as pointed out in https://stackoverflow.com/a/1379370/1001563
If you know what you're searching for you'll find the answer without having to ask. Thanks to @VladfromMoscow