On Wed, 2005-11-23 at 00:56 +1100, Matthew Hannigan wrote:
> On Tue, Nov 22, 2005 at 05:49:49PM +1100, Benno wrote:
> > I can't actually find it in the C spec but from googling it does appear
> > that string literals are constants with static storage duration which
> > means they have lifetime of the program.
> > 
> > (But I still wouldn't use that style, it is confusing at best.)
> 
> 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.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
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