Kenny said:
"]
Is this valid in C99:
int main(void)
{
printf("%s\n", char *p = foo());
return 0;
}
char *foo()
{
return "abc";
}
No. It will not compile. Even if you correct it to do so, it still
invokes undefined behaviour.
I would imagine that the truth of the later assertion depends very much
on exactly what specific changes are made in order to get it to compile.[/QUOTE]
Correct, more so considering the question is about C99, and C99 does not
allow for implicit function declarations. Using an undeclared identifier,
such as printf or foo here, is a syntax error in C99. Trying to fix that by
declaring char *printf(); or something equally silly obviously means the
behaviour is undefined, but assuming you don't do that, I see no UB.