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: [C++ PATCH] warning about empty extern "C" structures


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 !!!

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....



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