[m-dev.] for review: runtime fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Aug 9 18:28:41 AEST 1999


On 09-Aug-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
>  incr_hp_debug_msg(Word val, const Word *addr)
>  {
>  #ifdef CONSERVATIVE_GC
> -	printf("allocated %ld words at %lu\n", (unsigned long) val, addr);
> +	printf("allocated %ld words at %p\n", (unsigned long) val, addr);

The format specifier "%p" expects a `void *', but you're passing an
`unsigned long'.  If you want to make this change, you should also change
the cast to cast to `void *'.

> +MR_print_heapptr(FILE *fp, const Word *s)
> +{
> +#ifdef	CONSERVATIVE_GC
> +	fprintf(fp, "heap %ld (%p)",
> +		(long) s, (const void *) s);

It's probably better to use `%lu' rather than `%ld' and to cast to
`unsigned long' rather than `long'.

Apart from those minor points, this change looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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