Re: [cc65] return vs. exit()

From: <silverdr1wfmh.org.pl>
Date: 2009-10-19 00:28:45
On 2009-10-19, at 00:11, Ullrich von Bassewitz wrote:

> Finishing/fixing the code for attributes was overdue anyway. You can  
> now also
> use "__attribute__((unused))" on a symbol to avoid warnings. And  
> there will be
> more attributes in the future.

Good, I very much like the way CC65 is going on!

>> ar65: Warning: Replacing module `systime.o' by older version
>
> ... this is unknown to me, so I would suggest checking the reason.

It pops up in such context:

make -C ../runtime/ zeropage.o
rm c16-ram.o c16-stdjoy.o
ar65: Warning: Library `c16.lib' not found - will be created
ar65: Warning: Replacing module `systime.o' by older version
cp c16/*.joy .
cp c16/*.emd .
for i in c128 cbm common runtime conio dbg em joystick mouse serial  
tgi zlib; do \
	    make SYS=c128 -C $i || exit 1; \
	    ../src/ar65/ar65 a c128.lib $i/*.o;\
	done
make -C ../runtime/ zeropage.o
rm c128-640-200-2.o c128-1351.o c128-ram.o c128-vdc.o c128-stdjoy.o  
c128-georam.o c128-ramcart.o c128-ptvjoy.o c128-joymouse.o  
c128-640-480-2.o c128-swlink.o c128-potmouse.o c128-reu.o
ar65: Warning: Library `c128.lib' not found - will be created
ar65: Warning: Replacing module `systime.o' by older version

Not with all the .libs though. Maybe only with those, which have that  
implemented?

> IO is there, the problem is in the call to fopen. "ro" is an invalid  
> mode, [...]
> Just change the mode to "r" and the program should work.

Damn! You are perfectly right... I probably took it (the mode string)  
from one of the other languages I programmed in without re-checking :-(

> As a general rule:
> Checking return codes from functions will ease your life. Adding
>
>        if (fh == 0) {
>            perror ("fopen");
>            return EXIT_FAILURE;
>        }
>
> after the call to fopen() would have printed:
>
>        fopen: Invalid argument
>
> which might have been helpful.

Yes - sure. This was meant as quick'n dirty test. Normally I always  
opt for checking the returns and if I don't, I mark it clearly as  
TODO. Here I of course could have checked it myself but this was such  
a simple few-liner.. Okay - thank you.

-- 
SD!

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Oct 19 00:28:53 2009

This archive was generated by hypermail 2.1.8 : 2009-10-19 00:28:55 CEST