This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc visibility used by moz
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Tristan Wibberley <maihem at maihem dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 12 Jul 2006 20:45:05 +0900
- Subject: Re: gcc visibility used by moz
- References: <44B412CC.5000507@smedbergs.us> <44B41C1A.3010000@redhat.com> <44B44AA5.10506@maihem.org>
On Jul 12, 2006, at 10:04 AM, Tristan Wibberley wrote:
This isn't "type" visibility. Shared objects don't export "types"
they export "symbols". The types are defined in headers and are
thus known to exist - no visibility attributes will or should
change that.
Actually in C++, they are exported, it is one of the "funny" things
which people don't realize about
C++. This is the normal ODR (one definition rule) rules which are
coming into play which
the visibility on the class, it is not no longer exported from the
shared library.
If the programmer had intended that the type should appear to not
exist. it wouldn't be defined in a header #include-able by client
code. The compiler should assume that the type exists and can be
used if it is defined and shouldn't change attributes on other
parts of the program.
But that code would be invalid (though no diagnostic is required)
code by the ODR rules in C++.
This is the main difference between C++ and C where in C compatible
types actually can have different
names while in C++ they cannot and if two different types in C++ are
the same name, the code is invalid
(though no diagnostic is required).
-- Pinski