On Wed, Nov 23, 2005 at 09:24:46AM +1100, Robert Collins wrote:
> > I've used it for error messages; a 0 return means ok,
> > non-0 is an error message to be spat out.
> > 
> > I'm sure I've seen gnu software use it too; possibly
> > even this way.
> > 
> > fwiw, I'm far from sure it's a great idea, but it sure
> > beats mallocing something that is never going to be changed.
> 
> Well for long lived programs, you usually dont assume that *all* errors
> will be static, some may have dynamic content. So that implies (in the
> common case) that the emitter of the error will clean it up (unless you
> have a pseudo object system where you pass the used error back to the
> creator). Its the emitter cleaning it up that implies that all errors
> should be 'free'able.

Yeah, this was just for a hundred liner for my own use.

FWIW, again, the code just did

        return "Error: pants missing";

rather than actually use a variable.

I think that reads very cleanly.

--
Matt
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to