This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 1/2] Overload resolution among children of a common ancestor
- From: Tom Tromey <tromey at redhat dot com>
- To: sami wagiaalla <swagiaal at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 Oct 2010 09:43:35 -0600
- Subject: Re: [patch 1/2] Overload resolution among children of a common ancestor
- References: <4C7BD80C.1050906@redhat.com> <4CBDFF43.7000403@redhat.com>
>>>>> "Sami" == sami wagiaalla <swagiaal@redhat.com> writes:
Sami> This patch introduces a rank struct to be used instead of the int that
Sami> is normally used to represent the rank of a conversion.
Thanks.
I have a few nits to pick but nothing serious.
Sami> +/* Return the sum of the rank of A with the rank of B. */
Sami> +struct rank
Blank line between comment and start of function.
Sami> +/* Compare rank A and B and return:
Sami> + 0 if a = b
Sami> + 1 if a is better than b
Sami> + -1 if b is better than a. */
Sami> +int
Sami> +compare_ranks (struct rank a, struct rank b)
Likewise.
Sami> - LENGTH_MATCH (bv) = (nargs != nparms) ? LENGTH_MISMATCH_BADNESS : 0;
Sami> + LENGTH_MATCH (bv) = (nargs != nparms) ? LENGTH_MISMATCH_BADNESS : EXACT_MATCH_BADNESS;
I think this needs a line break.
Sami> /* Badness if parameter list length doesn't match arg list length */
Sami> -#define LENGTH_MISMATCH_BADNESS 100
Sami> +static const struct rank LENGTH_MISMATCH_BADNESS = {100};
Instead of defining a static instance in the header, define a single
instance with a different (not upper-case) name in a .c file, put an
extern declaration in the header, and then make the #define refer to it.
Tom