22 Sep
2009
22 Sep
'09
1:49 p.m.
Mike Kaplinskiy wrote:
It actually does not dereference anything. Try passing null into the function - it will work just fine. This is a special case because the array isn't dynamically allocated but is part of the struct, which means that dmW->dmFormName == (dmW+__offset of dmFormName) and not *(dmW+__offset of dmFormName). You can try writing a test program yourself - it will run just fine. It does dereference the pointer. Here is your simple test. Compile it and run it. See what happens.
#include <stdio.h> typedef struct _s_test { void *pointer; } s_test; int main() { s_test *s = NULL; long diff = (const char*)s->pointer - (const char*)s; printf("diff=%ld\n", diff); return 0; } Vitaliy.