|
From: Julian S. <js...@ac...> - 2006-01-21 03:19:42
|
> {
> int i = 4;
> static int j = 5;
> ELAN_EVENT *e = elan_get(elan_base->state,&j,&i,sizeof(int),0);
> printf("i is %d\n",i);
> elan_wait(e,ELAN_POLL_EVENT);
> printf("i is %d\n",i);
> }
>
> The prototype for elan_get is this, it starts a simple network read:
> extern ELAN_EVENT *elan_get (ELAN_STATE *state, void *source, void
> *target, size_t len, uint32_t srcvp);
>
> In this code the result of first printf is undefined and the second one
> will print 5. I was hoping Valgrind could be made to flag an error on
> the first printf.
I think you're hoping for a bit much. You assigned a value to i
at the start so it's defined.
But if I read this correctly, elan_get just remembers &i (presumably
in ELAN_EVENT which is some kind of handle) and writes the actual
amount of received data there in elan_wait. So why don't you
start with no value in i - then V will consider it undefined until
elan_wait writes it.
> {
> int i;
> static int j = 5;
> [...]
J
|