Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: