Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Printf: variable field width/precision
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thorsten Ohl <ohl@h...>
Subject: [Caml-list] Printf: variable field width/precision
In the C library, printf(3) supports variable field widths and
precisions with the `*' specifier.

   The field width

       An optional decimal digit string (with nonzero first digit)
       specifying a minimum field width.  [...]  Instead of a decimal
       digit string one may write `*' or `*m$' (for some decimal
       integer m) to specify that the field width is given in the next
       argument, or in the m-th argument, respectively, which must be
       of type int. [...]

Unfortunately, neither the O'Caml library nor the compiler accept `*'.
If the `*' form is available, the `*m$' form is hardly needed, but I
couldn't find a way to hack around the missing `*' (handling every
conceivable width/precision pair as a special case doesn't count ...).

Is there are chance that variable field widths for the benefit of
numerical programs will be supported in the future?  [It would be easy
to hack the library, but since the compiler must perform its own magic
for type safety, I couldn't distribute the code without asking users
to patch the compiler.]

Or does anybody know a nice workaround?

Merci,
-Thorsten
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr