This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 1/2] Overload resolution among children of a common ancestor


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]