This is the mail archive of the
mailing list for the GCC project.
Re: [cxx-conversion] Support garbage-collected C++ templates
On 12-08-08 16:12 , Gabriel Dos Reis wrote:
just a word on style in the documentation:
+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
A proper way to bring a symbol into local scope is through
I struggled a bit with this. I need to tell the template function that
there exists a free function gt_pch_nx that takes a T&. This is not
something that any header file has at the point of this declaration.
The function gt_pch_nx(T&) is declared and defined later in one of the
gt-*.h files. This is another problem with the way that gengtype works
The using-declaration that you propose does not seem to give me what I
want, though. How does it know that the function takes a T&?