Re: [cc65] calloc() not failing

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-11-13 11:31:58
Hi,

>> Initialized data is no longer initialized correctly if
>> the program runs the second time. [...]

> ?! This sounds like a bug, even if the solution involves wasting the same
> amount of memory as the initialized data section. And even more memory is
> wasted when someone tries to work this around by initializing variables
> explicitly by code.

Then all C compilers (at least the ones known to me) have this bug ;-)
I've never heard of a C compiler keeping an "internal shadow copy" of
everything changed by a program. That's what the secondary storage is
for.

And by the way I find it very interesting that such a big
misunderstanding can live so long: In example that whole R/O segments
vs. R/W segments thingy incl. the ld65 options to specify different
load and run addresses exists only because it's absolutely natural to
write to non-BSS segments - thus obviously loosing the original
values!

> otherwise people are shooting themselves in the foot right now.

Therefore I agree with you that it might be worth to invest (a
considerable small amount of) resources to explicitly "invalidate" the
program on running it for the first time. Most other targets don't
have that issue as loading and running is usually a single step there.
So nobody has the "weird" idea of being able to run a program again.

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 13 11:32:49 2012

This archive was generated by hypermail 2.1.8 : 2012-11-13 11:32:53 CET