A
Army1987
Is this program legal C89?
/* no headers included */
int main(void)
{
if (sizeof (exit(0), 0),
((void (* )(int))&exit)(
(puts((const char *)"hello, world"), 0)
),
0) {
}
}
The the first operand of the first comma serves to implicitly
declare exit() as returning an int, but it is never called as
such. Does that wrong implicit declaration cause UB by itself,
even if the function is eventually called with the right type?
/* no headers included */
int main(void)
{
if (sizeof (exit(0), 0),
((void (* )(int))&exit)(
(puts((const char *)"hello, world"), 0)
),
0) {
}
}
The the first operand of the first comma serves to implicitly
declare exit() as returning an int, but it is never called as
such. Does that wrong implicit declaration cause UB by itself,
even if the function is eventually called with the right type?