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


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

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

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.

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/


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