[Top][All Lists]

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

Re: use of program_name

From: James Youngman
Subject: Re: use of program_name
Date: Thu, 5 Jan 2006 22:40:38 +0000
User-agent: Mutt/1.5.9i

On Thu, Jan 05, 2006 at 02:03:27PM -0800, Paul Eggert wrote:
> Because the current convention is to put this declaration in the main
> program, at the top level:
> char *program_name;
> Hence the main program has allocated program_name, and has arranged
> for it to be initialized to null.  If we put a similar declaration in
> error.c, it would cause two different definitions of program_name, and
> some non-Unix linkers reject this.  (The C Standard allows them to
> reject it.)
> > (If the interface to it was just set_program_name, it could be private.)
> Yes, that would be a better convention.  This will require revamping
> pretty much everybody that uses program_name, but I think it's worth
> the pain.  What do others think?

I'm against it, but not because of the extra work.  I don't mind that
since the amount of effort is trivial and I can choose when to do it
(i.e. I can choose when to reimport gnulib).

My problem is that we have changed the interface without making it
impossible for the user to use the new interface wrongly.  I would
prefer an arrangement which results in a compilation or link failure
if the user (i.e. software maintainer) fails to initialise things
properly.  A runtime failure is insufficiently helpful in my opinion.


reply via email to

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