[m-dev.] for review: interface tracing, part 2

Fergus Henderson fjh at cs.mu.OZ.AU
Fri May 15 14:18:56 AEST 1998


On 14-May-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> diff -u /home/staff/zs/mer/ws3/runtime/mercury_trace.h runtime/mercury_trace.h
> --- /home/staff/zs/mer/ws3/runtime/mercury_trace.h	Wed May 13 16:07:11 1998
> +++ runtime/mercury_trace.h	Mon May 11 11:53:31 1998
> @@ -50,10 +50,11 @@
>  extern	void	MR_trace(
>  	const MR_Stack_Layout_Label *,	/* layout info for the event */
>  	MR_trace_port,
...
> +	int);			/* is this event supposed to be traced */

I think the last argument here should be of type `bool' rather than `int'.

> +extern	Word		MR_trace_from_full;

I think this should be bool.

>  /* The interface between the debuggers and the tracing subsystem. */
>  
> @@ -115,8 +118,8 @@
>  
>  typedef struct {
>  	MR_trace_cmd_type	MR_trace_cmd;	
> -	int			MR_trace_stop_seqno;
> -	int			MR_trace_stop_event;
> +	Word			MR_trace_stop_seqno;
> +	Word			MR_trace_stop_event;

I think it would be better to use `Unsigned' rather than `Word' here
(and similarly for the corresponding global variables).

The idea behind this suggestion is that `Word' is an opaque type,
and `Unsigned' and `Int' are concrete types that are known to be
compatible with `Word'.

Actually we could do the same thing with `bool', i.e. define a `Bool'
type which conveys the same documentation value as `bool' but which
whose representation is compatible with `Word'.  This would be much
better than defining all these things as `Word' and adding explicit
comments saying that they're really booleans.

-- 
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.



More information about the developers mailing list