[PPL-devel] Re: [Caml-list] Question about warning message.

Roberto Bagnara bagnara at cs.unipr.it
Wed May 5 18:40:48 CEST 2004


David Brown wrote:
> On Wed, May 05, 2004 at 05:16:06PM +0200, Claudio Trento wrote:
>>my g++ compiler show me this warning:
>>  
>>    << warning: unused variable `int caml__dummy_n' >>
> 
> 
> It is part of the construct the headers use to implement the
> CAMLparam... macros.  Strictly it isn't necessary in C++, since you can
> have declarations in the middle of a block, but then there would be
> different constructs for C and C++.

That would not be a problem: most header files that must work
with both C and C++ do that.  For example, one thing that
the OCaml include files out to start and end with is

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
} /* extern "C" */
#endif

Similar things based on the __cplusplus macro allows to obtain
header files that are 100% standard compliant with respect to
both C and C++.

> BTW, what about having a
>   (void) caml__dummy_##x;
> 
> at the end of the CAMLxparam... macros?  This does shut up the warning,
> at least on gcc.

This would do the trick, even though it is a bit of a hack.
What do the OCaml developers think?
Are they willing to accept patches to solve these problems?
Cheers,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list