RE: [cc65] k&r c

Date view Thread view Subject view

From: shubel, paul (shubel_paul_at_emc.com)
Date: 2002-06-07 15:54:20


Hi Everyone,

Probably because no code was generated because the function was empty.
Try putting some code in without a return statement.


Best Regards,

Paul

PS (the cc65 list is great!)


-----Original Message-----
From: Christian Groessler [mailto:cpg_at_aladdin.de]
Sent: Friday, June 07, 2002 9:47 AM
To: cc65_at_musoftware.de
Cc: cpg_at_aladdin.de
Subject: [cc65] k&r c


Hi,

I recently tried to compile a k&r c program with cc65 and found some
inconstistent behaviour.
Consider the following code

---------
bla(s)
     int s;
{
     if (s == 0)
         return;
}
---------

cc65 refuses to compile it, I get

t.c(7): Error: Function `bla' must return a value

If I replace the "return;" with "return 0;" it gets compiled.

So my question, why is this an error and not a warning only?
And, if it should be an error, why is it no error when I simply drop
out of the function without a return?

regards,
chris

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-06-07 15:57:18 CEST