Subject: Re: syslog_r (Re: CVS commit: src/lib/libc)
To: Christos Zoulas <christos@zoulas.com>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-userlevel
Date: 10/26/2006 10:52:19
On Thu, Oct 26, 2006 at 10:26:15AM -0400, Christos Zoulas wrote:
> On Oct 26, 11:08pm, soda@sra.co.jp (SODA Noriyuki) wrote:
> -- Subject: Re: syslog_r (Re: CVS commit: src/lib/libc)
>
> | >>>>> On Thu, 26 Oct 2006 10:06:22 -0400,
> | christos@zoulas.com (Christos Zoulas) said:
> |
> | > I think that it is useful for a program to be able to syslog()
> | > from an "unsafe" context. What do others think?
> |
> | Even if that's useful, it's better to avoid the name like syslog_r(),
> | because the name implys that its format string is fully compatible
> | with syslog(), but actually it won't be compatible, as Thor said.
>
> The only thing it will be missing is floating point formats and this
> can be noted in the man page. It is not like there are a lot of syslog
> messages that use floating point numbers.
I'm sorry, I think that introducing an exception to the standard format
string rules like this is incredibly bad interface design, and documenting
it really does not make it much better. People already know how format
strings work and are unlikely to consistently notice that you've written
documentation (which they won't check, because they "know how it works
already", which they're entitled to believe) that says this case is
special.
This is almost a paradigm case of how _not_ to change interfaces to
software. It would be much better to simply provide a new function with
an interface that is not deceptively similar to one that people already
know.
Thor