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: [cxx-conversion] Support garbage-collected C++ templates


hi Diego,

just a word on style in the documentation:

> +template<typename T>
> +void gt_pch_nx (TP<T> *tp)
> +@{
> +  extern void gt_pch_nx (T&);
> +
> +  /* This marks field 'fld' of type 'T'.  */
> +  gt_pch_nx (tp->fld);
> +@}

'extern'  declaration at local scope if considered an extremely
poor style in C++.  Furthermore, it does not interact
well with template instantiations and scope rules; plus
it does not work well when the function actually has an
internal linkage.

A proper way to bring a symbol into local scope is through
a using-declaration:

     using ::gt_pch_nx;

-- Gaby


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