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:

> But, that is indeed poor.  So, let me try again.
> Currently (i.e. without my patch), they are defined as
> 
>    inline size_t
>    htab_size (htab_t htab)
>    {
>      return htab->size;
>    }
> 
>    inline size_t
>    htab_elements (htab_t htab)
>    {
>      return htab->n_elements - htab->n_deleted;
>    }

Yes, but, as you know, that is in hashtab.c, not hashtab.h.  I don't
see any reason they need to be in hashtab.h at all.

> I supposed that it was for performance reason why they were
> defined inline in hashtab.c, which is why I moved them to hashtab.h
> with the "static inline" marker.  They won't pose any problem with a
> C90 compiler that does not understand inline, and they won't cause any
> problem with a C90 compiler that does.  I'm also willing to turn them
> into macros if you prefer.

If we want them in hashtab.h, then I think they should be macros.  But
upon further reflection, I'm pretty sure we don't want them in
hashtab.h at all, and I think we should just remove "inline" in
hashtab.c.

Ian


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