delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/31/07:36:21

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Trace: 100944119/mk-filter-1.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.66.2.206/None/johne53 AT tiscali DOT co DOT uk
X-SBRS: None
X-RemoteIP: 79.66.2.206
X-IP-MAIL-FROM: johne53 AT tiscali DOT co DOT uk
X-MUA: Microsoft Outlook Express 6.00.2900.2180Produced By Microsoft MimeOLE V6.00.2900.2180
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AqwEACyYCklPQgLO/2dsb2JhbACEG1XIdYNR
X-IronPort-AV: E=Sophos;i="4.33,522,1220223600"; d="scan'208";a="100944119"
Message-ID: <004501c93b55$1c2e11d0$4001a8c0@mycomputer>
From: "John Emmas" <johne53 AT tiscali DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
References: <000201c93ac7$38265930$4001a8c0 AT mycomputer> <490A30C8 DOT 5000107 AT sh DOT cvut DOT cz> <001601c93b31$a961b940$4001a8c0 AT mycomputer> <003e01c93b42$e92a17a0$4001a8c0 AT mycomputer> <490AE8A0 DOT 8090009 AT sh DOT cvut DOT cz> <001a01c93b4d$617de150$4001a8c0 AT mycomputer> <490AF1E3 DOT 3020308 AT sh DOT cvut DOT cz> <002001c93b52$3b2b2490$4001a8c0 AT mycomputer> <028e01c93b53$53e17a60$9601a8c0 AT CAM DOT ARTIMI DOT COM>
Subject: Re: cygwin g++ strictness
Date: Fri, 31 Oct 2008 12:35:08 -0000
MIME-Version: 1.0
X-Mailer: Microsoft Outlook Express 6.00.2900.2180
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

----- Original Message ----- 
From: "Dave Korn"
Sent: 31 October 2008 12:22
Subject: RE: cygwin g++ strictness
>
> You are creating temporaries here.  If AddTwoInts modifies either of the
> int references it has, that will only change the temporaries; x and y will
> /not/ be modified.

You'll be surprised if you try it Dave....

int AddTwoInts (int& a, int& b)
{
    int x = a;
    int y = b;

    a = 6;  // Note this line

    return x + y;
}

int main()
{
int32_t  m=4;
gint  n=5;

    AddTwoInts ((int&)m, n);

    return 0;  // 'm' equals 6 by the time you get to this line !!
}

I was surprised too - but it works (!?!)

John


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019