From: Henry N. <hen...@ar...> - 2011-01-11 00:01:20
|
Hello Vladislav, On 11.01.2011 00:13, Vladislav Grishenko wrote: > Dear Henry, > Sure it was't work the way you wrote >> #define co_offsetof(TYPE, MEMBER) ((int)&((TYPE *)0)->MEMBER) > But proposed define had member-whatever-it-contains bracket escaping >> #define co_offsetof(TYPE, MEMBER) ((int) (&((TYPE *)0)->MEMBER)) > So, with MEMBER == field+const it will be equal to start_of_field + > const*size_of_filed OK. That give the test result: 10 5 10 10 Is the "MEMBER + const" right in usage of that macro? Or is that a side effect in calculation? > Anyway, I'd like to see it fixed in svn :) > Btw, there's a lot of places with old style calculations, I mean without > co_offsetof usage, even right several lines below the discussing line. I only changed that line in revision 1560, because the GCC 4.4.1 under Linux as host has a warning. If you have more such changes, be welcome. -- Henry N. |