Version franaise
Home About Download Resources Contact us
Browse thread
precision not working properly for strings in Printf?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Thomas <david_hd@y...>
Subject: Re: [Caml-list] precision not working properly for strings in Printf?
While it is true that, theoretically, changing this to
be in line with the C libraries has the potential to
break existing code, I would stipulate that any code
that would be broken by this change is already broken.
 My reasoning is as follows.

The Printf format strings are intended to be intuitive
to anyone who has worked with printf in C.  This
deviation, therefore, means that someone reading
through code that says %.ns will reasonably but
incorrectly come to a conclusion as to what that
means.  As there is a shorter way of expressing
exactly the same thing, of greater clarity, in line
with expectations, I would be quite surprised if any
code does use %.ns to mean %ns, and I think that any
such instances should be changed for the sake of
clarity even absent any changes to the library.

I conclude that, absent strong internal reasons for
not doing so (and I have not looked at the
implementation of the library, so I cannot speak to
these), the behavior of %.ns should be declared a bug
and brought in line with the C libraries.  Failing
this, it should be a warning/error to use %.ns as
there is no motivation to do so, it is misleading when
others consider the code, and it will more quickly
inform the programmer that they cannot produce the
desired effect in this manner.


       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/