From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31464 invoked by alias); 23 Nov 2012 09:37:43 -0000 Received: (qmail 31455 invoked by uid 22791); 23 Nov 2012 09:37:43 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Nov 2012 09:37:09 +0000 Received: by mail-ie0-f175.google.com with SMTP id qd14so7870325ieb.20 for ; Fri, 23 Nov 2012 01:37:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.203.100 with SMTP id kp4mr2978731igc.35.1353663429289; Fri, 23 Nov 2012 01:37:09 -0800 (PST) Received: by 10.42.158.202 with HTTP; Fri, 23 Nov 2012 01:37:09 -0800 (PST) In-Reply-To: <72041471EE7D1540B7ECD771EA430DB70622524E@AMESS102.proton.intra.irsn.fr> References: <72041471EE7D1540B7ECD771EA430DB7062251ED@AMESS102.proton.intra.irsn.fr> <72041471EE7D1540B7ECD771EA430DB70622524E@AMESS102.proton.intra.irsn.fr> Date: Fri, 23 Nov 2012 09:37:00 -0000 Message-ID: Subject: Re: [C++] anonymous struct linkage From: Jonathan Wakely To: LAMOME Julien CS-SI Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00186.txt.bz2 On 23/11/2012, LAMOME Julien CS-SI 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 > struct {double variable;}demof; > extern "C" void toto(); > int main() > { > demof.variable=3.14159; > std::cout<<"C++ variable = "< 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.