bug-gnulib
[Top][All Lists]
Advanced

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

Re: use of -fno-common on Darwin


From: James Youngman
Subject: Re: use of -fno-common on Darwin
Date: Tue, 10 Jan 2006 21:34:28 +0000
User-agent: Mutt/1.5.9i

On Tue, Jan 10, 2006 at 11:07:20PM +0900, Peter O'Gorman wrote:

> char *
> get_prog_name(void)
> {
>       char * name;
>       if (prog_name)
>               name = prog_name;
>       else
>       {
> #if defined(HAVE_GETPROGNAME)
> #include <stdlib.h>
>               name = getprogname();
> #elif defined(HAVE_GETEXECNAME)
> #include <stdlib.h>
>               name = getexecname();
> #elif defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
> #include <errno.h>
>               name = program_invocation_short_name;
> #else
>               name = "executable";
> #endif
>       }
>       return name;
> }

If we adopted this code, application authors would still be obliged to
call set_program_name() since there would still be platforms where the 

>               name = "executable";

clause is executed.  However, this clause will only be exercised on
some systems, so having a good default here simply helps to mask bugs.
This is especially unfortunate where developers have a machine which
can figure out the executable name unaided, but end-users don't.

James.





reply via email to

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