This is the mail archive of the gcc@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: Using C++ in GCC is OK


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

Definitely. That document is interesting in that it offers views and rationale
about some of the restrictions being put forward. For example, I would not
discount easily sections 4.10, 4.11, 4.12.

I think we have grounds to modify 4.11 .


: AV Rule 98:
:    Every nonlocal name, except main(), should be placed in some namespace.

I think for global symbols that are part of the plugin interface, C linkage
is preferable, because that allows to implement the plugins with C and
other languages that allow for linking with C code.  Moreover, it protects
the plugin interface from variations in name mangling over time or across
different C++ implementations.
We should also evaluate carefully if debugging helper functions (e.g. ones
that are called by a dubugger like gdb or vender-supplied debugger) are
better off with C linkage for stability & compatibility.

: AV Rule 99
:   Namespaces will not be nested more than two levels deep.
:AV Rule 100
:   Elements from a namespace should be selected as follows:
:      Â using declaration or explicit qualification for few
:        (approximately five) names,
:      Â using directive for many names.

Would this be solely applied to explicitly coded namespace usage, or
also to namespace usage introduced by the build infrastructure?
My approach to combine multiple backends puts functions duplicated
across different backends into different namespaces.  If you have already
exhausted two namespace nesting in the general code, that would add a
third layer.
Also, the selection of namespace members is restricted to what can be
readily done with macros given the known context, and it is not known in the
first place how many members there are to be selected in the first place.


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