Glenn Fowler wrote:
> On Tue, 17 Oct 2006 00:43:05 +0200 Yann POUPET wrote:
>> I did not want to modify a so widely used function, and did not want
>> either to take the risk to break some compatibilities. If we chose, for
>> example, something like %M for metric, what would happen  for  sofware
>> who already use %M in their printf format string ? Right now,
>> printf("%5M",(double)1/3)) will output "M". Of course, this syntax is
>> weird since %M does not correspond to anything, but we cannot be sure
>> it's not used somewhere.
> 
> on the other hand we should be grateful that the (hypothetical) ancestral
> floating point challenged printf was extended to handle %f rather than
> human_floating_point()
> 
> surely there must be room within the standard(s) to extend printf format
> chars

Of course.

 From the really fine man page:

      If a conversion specification does  not  match  one  of  the
      above forms, the behavior is undefined.

So as the current behavior of %5M is undefined, adding new conversion
characters will not break an existing correct application, where
correct is defined as not relying on explicitly undefined behavior.

Personally, I think we'd make life better for everyone if we just
dumped core in this sort of case, but that's another discussion.

- Bart

-- 
Bart Smaalders                  Solaris Kernel Performance
barts at cyber.eng.sun.com              http://blogs.sun.com/barts

Reply via email to