delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/31/06:55:24

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Spam-Score: -63.809
Message-ID: <490AF1E3.3020308@sh.cvut.cz>
Date: Fri, 31 Oct 2008 12:54:11 +0100
From: =?windows-1252?Q?V=E1clav_Haisman?= <v DOT haisman AT sh DOT cvut DOT cz>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin g++ strictness
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>
In-Reply-To: <001a01c93b4d$617de150$4001a8c0@mycomputer>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

John Emmas wrote:
> ----- Original Message ----- From: "Václav Haisman"
> Sent: 31 October 2008 11:14
> Subject: Re: cygwin g++ strictness
>>
>> Check what type is gint really is. I suspect the gint will be typedef
>> for long. Long and int are two different types even though they are both
>> 32bits wide on 32bit platforms.
> 
> Thanks Vaclav.  It must be something like that because I've noticed that if
> the function prototype is changed to look like this:-
> 
> int AddTwoInts (int& a, int& b);
> 
> this works.....
> gint x = 4;
> gint y = 5;
> int z = AddTwoInts (x, y);
> 
> wheareas this doesn't.....
> int32_t x = 4;
> int32_t y = 5;
> int z = AddTwoInts (x, y);
> 
> So, even though it looks like 'sys/types.h' is typedefing int32_t as an
> int,
> that section must either be getting conditionally (not) compiled or maybe
> int32_t is getting redefined somewhere else.
Try getting preprocessed source to see where int32_t get defined to
anything else than typedef of int.

> 
> Having said all that, most compilers provide implicit conversions between
> related types.  gcc4.4 seems to be doing that and I'm pretty sure that MSVC
> would allow it also (although I haven't tried it).
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.

> 
> Thanks also for the suggestion about changing to temporary variables but it
> won't help in this case because this isn't my own code and I'd probably
> need
> to change dozens of modules.  Explicit casting is probably the safest
> solution.
No, casting is not an option, really. You have references. What do you
intend to cast x and y to?

- --
VH

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iFYEAREIAAYFAkkK8eIACgkQhQBMvHf/WHl+kgDfYntRu/+NS1A6Z5/2TYlV96K0
Tih8AggNNdhejADeMweLvprsehppWaNqAczAv/DJ5NWQwBYJicAUzA==
=MlgZ
-----END PGP SIGNATURE-----

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