This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 to libiberty: Move to the intersection of C90 an C++


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> -extern size_t	htab_size (htab_t);
> -extern size_t	htab_elements (htab_t);
>  extern double	htab_collisions	(htab_t);
>  
> +   
> +/* Return the current size of given hash table. */
> +
> +static inline size_t
> +htab_size (htab_t htab)
> +{
> +  return htab->size;
> +}
> +
> +/* Return the current number of elements in given hash table. */
> +
> +static inline size_t
> +htab_elements (htab_t htab)
> +{
> +  return htab->n_elements - htab->n_deleted;
> +}
> +

This seems like an unrelated change.  Why make it?  In libiberty we
try to be backward compatible to C90 compilers, and they won't
understand inline.  If there is a performance advantage here, let's
just use a preprocessor macro.  Otherwise, I don't think this is
related to converting to C++.

I see that you removed the functions in hashtab.c.  I think we might
just as well not mark them inline in hashtab.c, if that is what it
takes to fix this for C++.

The other changes are OK.  Thanks.

Ian


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