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