public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: LAMOME Julien CS-SI <julien.lamome-cs-si@irsn.fr>
Cc: gcc-help@gcc.gnu.org
Subject: Re: [C++] anonymous struct linkage
Date: Fri, 23 Nov 2012 09:37:00 -0000	[thread overview]
Message-ID: <CAH6eHdTwgVkPyYdV3LQWG08THZjqi56DoeRswUi8VX=o6tGjAA@mail.gmail.com> (raw)
In-Reply-To: <72041471EE7D1540B7ECD771EA430DB70622524E@AMESS102.proton.intra.irsn.fr>

On 23/11/2012, LAMOME Julien CS-SI <julien.lamome-cs-si@irsn.fr> 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.

  reply	other threads:[~2012-11-23  9:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 15:44 LAMOME Julien CS-SI
2012-11-22 15:49 ` Andrew Haley
2012-11-22 18:53 ` Ángel González
2012-11-22 21:03 ` Jonathan Wakely
2012-11-22 21:06   ` Jonathan Wakely
2012-11-23  7:58     ` LAMOME Julien CS-SI
2012-11-23  9:37       ` Jonathan Wakely [this message]
2012-11-26 15:49       ` Ángel González

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdTwgVkPyYdV3LQWG08THZjqi56DoeRswUi8VX=o6tGjAA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=julien.lamome-cs-si@irsn.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).