Re: [C++] anonymous struct linkage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/11/2012, LAMOME Julien CS-SI <julien.lamome-cs-si@xxxxxxx> wrote:
> a minimum code to show the problem :
> toto.F :
>       subroutine toto()
>       implicit none
>       real*8 variable
>       common /demof/variable
>
>          print*,'Fortran variable=',variable
>       end
>
> toto.cc:
> #include <iostream>
> struct {double variable;}demof;
> extern "C" void toto();
> int main()
> {
> 	demof.variable=3.14159;
> 	std::cout<<"C++  variable = "<<demof.variable<<std::endl;
> 	toto();
> 	return 0;
> }
>
> * Gcc 4.1 give me :
> C++  variable = 3.14159
>  Fortran variable= 3.14159000000000
> * Gcc 4.6 give me:
> C++  variable = 3.14159
>  Fortran variable= 0.00000000000000
>
> Yours differents solutions work, but I would prefer to use an option to have
> the old behavior. Because, I have 163 files with anonymous strut to modify.
> And, each file require special attention because struct are linked, or not,
> with a COMMON, and COMMON are not necessary include in source, etc.
> So, if it isn't possible to use an option, I will have a lot of work now.
> Else I could modify  progressively.



The old behaviour does not conform to the C++ standard.

I don't think there is any option to restore the old non-conforming behaviour.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux