cppcheck sept 18 redux
Vitaliy Margolen
wine-devel at kievinfo.com
Tue Sep 22 08:49:17 CDT 2009
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.
More information about the wine-devel
mailing list