Re: [cc65] Why crashing attempting to free this struct?

From: Gábor Lénárt <lgb1lgb.hu>
Date: 2012-03-26 23:16:24
On Mon, Mar 26, 2012 at 02:00:57PM -0500, Payton Byrd wrote:
> > On Mon, Mar 26, 2012 at 01:31:48PM -0500, Payton Byrd wrote:
> > >    Found and fixed the problem in the above code.  There is no return
> > >    statement in this function, so the return value was random memory
> > >    locations  which meant code was getting overwritten.  Is there not
> > >    supposed to be a warning or error generated in such a scenario?
> >
> > I get
> >
> >        test.c(43): Warning: Control reaches end of non-void function
> >
> > when trying to compile the code. Apart from that I would not hardcode the
> > size
> > of the "name" field (17) in cbm_direntry and instead use sizeof. Your code
> > will break if the header file changes.
> >
> >
> Would it be possible to get a pragma that throws a compile error instead of
> a warning?

It's only good at a global level, for ALL warning :) I mean, good code
should not generate even warnings. I use the theory with gcc to compile
everything with -Werror, so warnings are errors. Of course gcc an produce
warnings even in case of "not fatal" but "common programmer misstakes".
Anyway, in my practice, the compiler was quite smart to warn me to avoid
certain situations even if they are "legal by standards". I am not sure if
cc65 has a switch like gcc's -Werror, -W is for suppress warnings, I would
need the opposite: make all of them as errors :) However, I guess it's not a
good business to make 'per warning type error switch/pragma', it could be
all or nothing stuff though. But maybe cc65 is evolving quickly to be able
to use 'warnings as errors' in case of some minor modifications between
different versions or so :)

Anyway, even without this, good code should not throw even "non-fatal
warnings" in my opinion. Well, it can be compiler bug as well if it does :)



----------------------------------------------------------------------
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 Mar 26 23:16:43 2012

This archive was generated by hypermail 2.1.8 : 2012-03-26 23:16:47 CEST