[m-dev.] for review: label_stats

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jan 8 15:35:25 AEDT 2001


On 08-Jan-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> +void
> +MR_label_layout_stats(FILE *fp)
> +{
> +	const MR_Module_Layout		*module_layout;
> +	const MR_Module_File_Layout	*file_layout;
> +	const MR_Stack_Layout_Label	*label_layout;
> +	int				module_num, file_num, label_num;
> +	MR_Trace_Port			port;
> +	int				total;
> +	int				histogram[MR_PORT_PRAGMA_LATER + 1];

Rather than using MR_PORT_PRAGMA_LATER + 1 here,
you should define a constant named e.g. MR_NUM_PORTS
in the header file and use that.

> +	for (port = MR_PORT_CALL; port <= MR_PORT_PRAGMA_LATER; port++) {
...
> +	for (port = MR_PORT_CALL; port <= MR_PORT_PRAGMA_LATER; port++) {

These loops should be written using 0 and MR_NUM_PORTS for the bounds
(with `<' rather than `<='), rather than depending on the order of the
values in the enum.

Otherwise that looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  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