[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Denemo-devel] Re: Libsmf and exits.

From: Richard Shann
Subject: [Denemo-devel] Re: Libsmf and exits.
Date: Sun, 30 Aug 2009 21:16:35 +0100

On Sun, 2009-08-30 at 21:42 +0200, Edward Tomasz Napierala wrote:
> On 0830T1954, Richard Shann wrote:
> > > Few days ago, you mentioned on #denemo that it would be nice if libsmf
> > > never called exit(3).  Exactly in what situation it does that?
> > 
> > It is where assert() is called. (I didn't realize that, or forgot).
> > Perhaps all we need to do in denemo is re-define assert()? But I guess
> > that really a slightly different style of api is needed, where the
> > library sets up a GError structure and returns to the caller wherever
> > the assert()s occur.
> Hm.  The assumption was that asserts mean a bug in the library,
> and crashing the application is a good way to force the user to report
> it to me.  I guess it doesn't quite work that way.
> I guess I'll just replace all calls to assert() with calls to g_assert().
> I believe in 'normal' builds, it prints out error message to stderr,
> but doesn't abort execution.
the problem with this might be that you may induce a "real" crash if you
continue with the function. One school of thought has it, I think, that
a library should just provide services and never exit. So if you
understand g_assert to continue with execution the rest of the code
would need to be written on the assumption that the g_assert may have
> Btw, I've added user_data pointer to smf_event_t and smf_track_t
> in the SourceForge SVN repository.  Would be great if all your local
> changes ended up there, so you don't have to keep it local.

That's great - you are ahead of us with the user_data field, AFAIK the
"rb" and "wb+" tweaks for windows are the only local changes we have -
the rest is plans.
I've taken the liberty of cc'ing this to denemo-devel so as to alert
Jeremiah to the possiblility of an update to libsmf, as it is his baby.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]