X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave.korn@artimi.com>
To: <cygwin@cygwin.com>
References: <000201c93ac7$38265930$4001a8c0@mycomputer> <490A30C8.5000107@sh.cvut.cz> <001601c93b31$a961b940$4001a8c0@mycomputer> <003e01c93b42$e92a17a0$4001a8c0@mycomputer> <490AE8A0.8090009@sh.cvut.cz> <001a01c93b4d$617de150$4001a8c0@mycomputer> <490AF1E3.3020308@sh.cvut.cz> <002001c93b52$3b2b2490$4001a8c0@mycomputer>
Subject: RE: cygwin g++ strictness
Date: Fri, 31 Oct 2008 12:22:23 -0000
Message-ID: <028e01c93b53$53e17a60$9601a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
Content-Type: text/plain; 	charset="iso-8859-1"
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <002001c93b52$3b2b2490$4001a8c0@mycomputer>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m9VCN3ej026418

John Emmas wrote on 31 October 2008 12:15:

> ----- Original Message -----
> From: "Václav Haisman"
> Sent: 31 October 2008 11:54
> Subject: Re: cygwin g++ strictness
>> 
>> That has nothing to do with your problem. Reference to int and reference
>> to long are two totally unrelated types. The implicit conversions of
>> C/C++ only apply to values, not references.
>> 
> Ah, fair enough, I'd never thought about it but it's obvious now you've
> mentioned it.
> 
> 
>> 
>> No, casting is not an option, really. You have references. What do you
>> intend to cast x and y to? 
>> 
> Maybe it's a happy accident but this seems to compile and link (and work)
> 
> int AddTwoInts (int& a, int& b);
> 
> int32_t x = 4;
> int32_t y = 5;
> int z = AddTwoInts ((int&)x, (int&)y);  // Compiles, links and works

  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.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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


