This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin g++ strictness


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

John Emmas wrote:
> ----- Original Message ----- From: "John Emmas"
> Sent: 31 October 2008 08:21
> Subject: Re: cygwin g++ strictness
>>
>> adding the compiler flag -fpermissive seems to have solved the problem.
>>
> 
> 
> ----- Original Message ----- From: "Václav Haisman"
> Sent: 31 October 2008 10:07
> Subject: Re: cygwin g++ strictness
>>
>> It just works. You are doing something wrong. There is nothing wrong
>> with GCC 3.4 in this respect.
>>
> 
> It seems like I spoke to soon.....  -fpermissive seems to have helped in
> some cases but not in every case.  I'll give an example. Please can someone
> tell me if I'm misunderstanding something here.  Consider the following
> function prototype (where 'gint' is typedef'd as an int in gtypes.h):-
> 
> #include <gtypes.h>
> int AddTwoInts (gint& a, gint& b);
> 
> This code compiles under both Linux/gcc4.4 and also under Cygwin:-
> gint x = 4;
> gint y = 5;
> int z = AddTwoInts (x, y);
> 
> This code compiles under Linux/gcc4.4 but not under Cygwin:-
> #include <sys/types.h>   // typedefs int32_t as int
> int32_t x = 4;
> int32_t y = 5;
> int z = AddTwoInts (x, y);
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. Either declare x, y as gint or use
temporaries for the AddTwoInts() call.

> 
> The last example produces this error on my system:-
> error: no matching function for call to `AddTwoInts(int32_t&, int32_t&)'
> note: candidates are: int AddTwoInts(gint&, gint&)
[...]

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

iFYEAREIAAYFAkkK6KAACgkQhQBMvHf/WHnLpwDeMNkb5Gf8KL5fkj1kGbYA94LM
cKMQbaW5jHxZXQDfRoB6wH03WYo8tliLcgpH2ceZ9gkGvy2YtbhbDg==
=KUkg
-----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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]