Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 pa_macro
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David MENTRE <david.mentre@g...>
Subject: Re: [Caml-list] camlp4 pa_macro
Hello,

2005/9/8, Dmitry Bely <dbely@mail.ru>:
> let debug = ref true
> 
> let log fmt =
>  if !debug then
>    Printf.kprintf print_string fmt
>  else
>    Printf.kprintf ignore fmt
> 
> will in fact give the same result. It does not solve the initial problem -
> completely remove the debugging code from the release binary.

If you use "let debug = true", i.e. remove the reference, the
debugging code is indeed removed for *native* compilation. See this
answer by Xavier Leroy:
http://groups.google.com/group/fa.caml/browse_frm/thread/e80a6b8cf550a9cc/f3bb4fc08274512d?tvc=1&q=mentre+leroy+avoid+compiling#f3bb4fc08274512d

BTW, the above old thread is very similar to this one, with different
techniques to have optional debug code.

Yours,
d.