So what do you think this program should print?
For me it prints -1 but that just doesn't make any sense, is this behaviour actually documented anywhere? This code compiles with the base system gcc(1) but clang(1) rejects it outright because a non-void function returns no value.
I came across this when trying to fix sysutils/ldapvi to compile with clang(1), there's one line where a function returning an int just returns without a value.
Code:
#include <stdio.h>
static int
testfunc(void)
{
return;
}
int
main(int argc, char *argv[])
{
int a = 100;
a = testfunc();
printf("%d\n", a);
return (0);
}
For me it prints -1 but that just doesn't make any sense, is this behaviour actually documented anywhere? This code compiles with the base system gcc(1) but clang(1) rejects it outright because a non-void function returns no value.
I came across this when trying to fix sysutils/ldapvi to compile with clang(1), there's one line where a function returning an int just returns without a value.