[m-dev.] for review: demangle instance declarations

David Glen JEFFERY dgj at hydra.cs.mu.oz.au
Fri Feb 5 00:48:05 AEDT 1999


On 02-Feb-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> DJ, could you please review this one?
> 
> --------------------
> 
> Estimated hours taken: 4
> 
> Implement demangling for instance declarations (i.e. base_typeclass_infos).

That change (including the change to the test cases) looks fine, thanks.


Here's a couple of little comments:

> Index: util/mdemangle.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/util/mdemangle.c,v
> retrieving revision 1.31
> diff -u -r1.31 mdemangle.c
> --- mdemangle.c	1998/07/27 19:45:07	1.31
> +++ mdemangle.c	1999/02/02 00:14:49
>
> @@ -134,9 +138,15 @@
>  		NULL
>  	};
>  
> +	static const char * trailing_context_3[] = {
> +		arity_string,
> +		NULL
> +	};
> +
> +	char name[1000];

Could you #define away that magic number, please? You don't seem to use the
number elsewhere (eg. you use strlen(name)), but it still just looks bad.

> +	const char * class_name;
> +	int class_arity;
> +	char class_arg_buf[1000];

Oops, told a lie. There it is again.

> +	*start = '\0';
> +	got_int = (sscanf(*start_ptr, "%d", num) == 1);
> +	*start = save_char;

Pure evil. (Good work ! ;-) )


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Homer, is this how you pictured
PhD student,                    |         married life?
Dept. of Comp. Sci. & Soft. Eng.|  Homer: Yup, pretty much... except we
The University of Melbourne     |         drove around in a van solving
Australia                       |         mysteries.



More information about the developers mailing list