This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] warning about empty extern "C" structures
Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> writes:
| On Wed, 2006-05-17 at 10:48 -0700, Andrew Pinski wrote:
| > On May 17, 2006, at 10:34 AM, Daniel Jacobowitz wrote:
| >
| > > - Using it in extern "C" in the GNU dialects is obviously broken,
| > > since
| > > it will be given the C++ layout, but the C version it is trying to
| > > interface will be given the C layout, and they will not match.
| >
| > Why? it only changes the linkage of the structs/variables/functions
| > and never the layout.
|
|
| There is smthg I'm missing. If it transforms a zero size structure into
| a non-zeros sized one, there is a modification in the layout. Otherwise,
| the program would not crash !!!
extern "C" does not do that. It is not a switch for language.
| A modified Roman program (first to correct errors and then to show the
| device_t sizes from C and C++ code) gives:
|
| Size in C: 1
| Size in C++: 2
|
| That is a layout difference....
but this is not a change due to 'extern "C"'. It is somethign that
exist independently of whether you use 'extern "C"' or not.
The real issue is that someone is trying to use something specifically
designed not to work for C++.
-- Gaby