Allan Adler schrieb:
> Suppose the program is:
> main() { fn1(); if (debug == 0) fn2();}
> where fn2() returns int and fn1() returns int*. Since main is implicitly
> being declared as returning int, is there a possible problem here?
main() lacks a proper definition of its type. Yours is deprecated. One of
the allowed
is
int main(int,char **)
> If
> debug does equal 0, then the last thing to execute is fn2, which returns
> the expected int. If debug does not equal 0, then the last thing to
execute
> is fn1() which returns an unexpected int*.
None of the two returns anything as there is no return statement, so yes,
you have a problem.
Your main() (implicitly) should return an int, but it doesn't.
int main(int argc,char **argv)
{
int result = fn1();
if (debug == 0)
fn2();
return result;
}
As I don't know what your intention is, I can only guess how the proper
main should
look like. Probably like the above.
So long,
Thomas
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|