Ian Lance Taylor <ian@airs.com> writes: > [EMAIL PROTECTED] (Kai Henningsen) writes: >> void test(void) >> { >> union { int i; double d; } u; >> int *ip; >> double *dp; >> int ii; >> double dd; >> >> ip = &u.i; >> *ip = 15; >> ii = *ip; >> dp = &u.d; >> *dp = 1.5; >> dd = *dp; >> printf("ii=%d dd=%f\n", ii, dd); >> } >> >> So you're saying this function is not valid? > > That function is valid.
I'm going to regret this, but... I don't follow. How is Kai's testcase different from: int ii; double dd; void foo (int *ip, double *dp) { *ip = 15; ii = *ip; *dp = 1.5; dd = *dp; } void test (void) { union { int i; double d; } u; foo (&u.i, &u.d); } ? foo() can write *dp before reading *ip. Richard