English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
[Caml-list] kprintf with user formatters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-15 (14:57)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] kprintf with user formatters
On Thu, 15 Jul 2004, Basile Starynkevitch [local] wrote:
> let zprintf fmt = Printf.kprintf (fun _ -> ()) fmt
> should be ok.

This would force string conversion of arguments, which is what I want
to avoid, because some of those computations (user-defined ones) would
just be too costly.

> But I think that the format string should not even be parsed. I've got
> no solution (except the one below) to this!

It has to be if you want to avoid those computations and return a
meaningful value.  But the recursive argument-eating function is ok for
me, too.

> The above hack was written with the same requirements, and provide the
> possibility to change log levels (or log flags actually).

Ok, I see.  This is certainly a way to do it, though it requires
the preprocessor.  It would still be nice to have an efficient, clean
solution without resorting to additional tools.  Thanks, anyway!


Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners