S
Seong-Kook Shin
Hi.
Just curiocity,
Because of pre-ANSI C, it is possible to have a function without specifying
return type of a function (which makes the return type 'int', though) and
give no 'return' statement. For example:
foo(int a, int b)
{
int sum;
sum = a + b;
}
void
bar(void)
{
int i = foo(1, 2);
...
}
In above code, the 'i' variable in bar() will have no useful value.
But what does the standard says? I overlooked the ISO C standard, but
found no mention about this problem.
Is this a kind of 'undefined bebavior'? Or 'unspecified behavior'?
If there's wrong point on my explanation, please enlighten me. ;-)
Or, could you give me the section number of ISO C document where it deals
with such case?
Just curiocity,
Because of pre-ANSI C, it is possible to have a function without specifying
return type of a function (which makes the return type 'int', though) and
give no 'return' statement. For example:
foo(int a, int b)
{
int sum;
sum = a + b;
}
void
bar(void)
{
int i = foo(1, 2);
...
}
In above code, the 'i' variable in bar() will have no useful value.
But what does the standard says? I overlooked the ISO C standard, but
found no mention about this problem.
Is this a kind of 'undefined bebavior'? Or 'unspecified behavior'?
If there's wrong point on my explanation, please enlighten me. ;-)
Or, could you give me the section number of ISO C document where it deals
with such case?