[m-dev.] bugs?

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 4 21:41:17 AEDT 2004


On 03-Feb-2004, Julien Fischer <juliensf at students.cs.mu.OZ.AU> wrote:
> 
> On Tue, 3 Feb 2004, Peter Schachte wrote:
> ...
> > Secondly, when I try to compile that code, I get several warnings from
> > the C compiler about missing int<->pointer casts:
> >
> >     mudla% mmake pointer_example.o 14:57
> >     mmc --compile-to-c --grade asm_fast.gc pointer_example >
> >     pointer_example.err 2>&1
> >     mgnuc --grade asm_fast.gc -- -c pointer_example.c -o pointer_example.o
> >     pointer_example.m: In function `pointer_example_module0':
> >     pointer_example.m:27: warning: assignment makes integer from pointer
> >     without a cast
> >     pointer_example.m: In function `pointer_example_module1':
> >     pointer_example.m:31: warning: passing arg 2 of `perform_calculation'
> >     makes pointer from integer without a cast
> >     pointer_example.m:31: warning: assignment makes integer from pointer
> >     without a cast
> >     rm pointer_example.c
> >
> > Any idea what the problem could be, or how to fix it?  I'm using gcc
> > 3.3.2 (Debian).  I get similar messages for any foreign interface code
> > I compile.
> 
> I believe the problem comes about because the type c_pointer is
> a value of type MR_Word

Yes.  The c_pointer type really ought to be mapped to `void *', not MR_Word.

However, as Julien said, now that we have "pragma foreign_type", using
that is a better alternative.  This is much more type-safe.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list