RE: cygwin g++ strictness

2008-11-06 Thread Mike Marchywka
> From: [EMAIL PROTECTED] > To:> Subject: RE: cygwin g++ strictness > Date: Sat, 1 Nov 2008 10:05:54 -0400 > > > > >> >>>> It is not portable to platforms with 16-bit int (although >>>> these days, such platforms are museumware).

Re: cygwin g++ strictness

2008-11-01 Thread Peter Rosin
Den 2008-10-31 16:35, skrev Eric Blake: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > According to Peter Rosin on 10/31/2008 9:19 AM: >> main(void) >> { >> int32_t i = 32; >> printf("%d", i); >> return 0; >> } >> $ gcc -c -Wall int.c >> int.c: In function `main': >> int.c:6: wa

RE: cygwin g++ strictness

2008-11-01 Thread Mike Marchywka
> >>> It is not portable to platforms with 16-bit int (although >>> these days, such platforms are museumware). >> >> That, or: >> - Running your car's engineware. >> - Exploding an airbag into your face on detecting a collisionware. >> - Recording your vital signsware. >> - Pumping insulin i

Re: cygwin g++ strictness

2008-11-01 Thread Ralph Hempel
Gary R. Van Sickle wrote: From: Eric Blake It is not portable to platforms with 16-bit int (although these days, such platforms are museumware). That, or: - Running your car's engineware. - Exploding an airbag into your face on detecting a collisionware. - Recording your vital signsware. - P

RE: cygwin g++ strictness

2008-10-31 Thread Gary R. Van Sickle
> From: Eric Blake > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > According to John Emmas on 10/31/2008 9:35 AM: > > question - when programming like this:- > > > > int32_t i = 32; > > printf("%d", i); > > > > is it reasonable for a programmer to assume that a type declared as > > int

RE: cygwin g++ strictness

2008-10-31 Thread Gary R. Van Sickle
> From: John Emmas > > - Original Message - > From: "Peter Rosin" > Sent: 31 October 2008 15:19 > Subject: Re: cygwin g++ strictness > > > > I some projects I'm involved with there's quite a bit of > the following: > > > &g

Re: cygwin g++ strictness

2008-10-31 Thread John Hardin
On Fri, 31 Oct 2008, John Emmas wrote: From: "Václav Haisman" I mean the -save-temps switch of GCC. Wow - that was really useful. In fact I tracked down the problem..! On Cygwin, '/usr/include/stdint.h' typedefs int32_t as long. The same file on my Linux partition typedefs it to int. I

RE: cygwin g++ strictness

2008-10-31 Thread Dave Korn
John Emmas wrote on 31 October 2008 15:35: > is it reasonable for a programmer to assume that a type declared as > int32_t will be compatible with "%d" when building for a 32-bit platform? The /only/ assumptions you may legitimately make are those encoded in the C language spec: sizeof (char) <

Re: cygwin g++ strictness

2008-10-31 Thread Corinna Vinschen
On Oct 31 09:35, Eric Blake wrote: > #include > > int32_t i; > printf("%"PRId32"\n",i); Oh, wow. I wrote Cygwin's inttypes.h file back in 2003, so you would think I'd remember these type specifiers. Cor... erm, uh, yes ...inna -- Corinna Vinschen Please, send mails regardin

Re: cygwin g++ strictness

2008-10-31 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to John Emmas on 10/31/2008 9:35 AM: > question - when programming like this:- > > int32_t i = 32; > printf("%d", i); > > is it reasonable for a programmer to assume that a type declared as int32_t > will be compatible with "%d" when buildi

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- Original Message - From: "Peter Rosin" Sent: 31 October 2008 15:19 Subject: Re: cygwin g++ strictness I some projects I'm involved with there's quite a bit of the following: [...] int.c:6: warning: int format, int32_t arg (arg 2) I must confess, this

Re: cygwin g++ strictness

2008-10-31 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Peter Rosin on 10/31/2008 9:19 AM: > main(void) > { > int32_t i = 32; > printf("%d", i); > return 0; > } > $ gcc -c -Wall int.c > int.c: In function `main': > int.c:6: warning: int format, int32_t arg (arg 2) > int.c:6: warning

Re: cygwin g++ strictness

2008-10-31 Thread Corinna Vinschen
On Oct 31 16:19, Peter Rosin wrote: > Den 2008-10-31 14:50, skrev Corinna Vinschen: >> On Oct 31 07:26, Eric Blake wrote: >>> But yes, it might be nice if cygwin used the same type as Linux, as we >>> claim to strive for Linux source compatibility. >> Why exactly? The important thing here is that

Re: cygwin g++ strictness

2008-10-31 Thread Peter Rosin
Den 2008-10-31 14:50, skrev Corinna Vinschen: On Oct 31 07:26, Eric Blake wrote: But yes, it might be nice if cygwin used the same type as Linux, as we claim to strive for Linux source compatibility. Why exactly? The important thing here is that int32_t is 32 bit wide, regardless of using int

Re: cygwin g++ strictness

2008-10-31 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Corinna Vinschen on 10/31/2008 7:50 AM: >> But yes, it might be nice if cygwin used the same type as Linux, as we >> claim to strive for Linux source compatibility. > > Why exactly? The important thing here is that int32_t is 32 bit wide

Re: cygwin g++ strictness

2008-10-31 Thread Corinna Vinschen
On Oct 31 07:26, Eric Blake wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > According to John Emmas on 10/31/2008 7:14 AM: > > On Cygwin, '/usr/include/stdint.h' typedefs int32_t as long. The same file > > on my Linux partition typedefs it to int. I must admit, I don't know what > >

Re: cygwin g++ strictness

2008-10-31 Thread Corinna Vinschen
On Oct 31 06:25, Tim Prince wrote: > John Emmas wrote: > > > On Cygwin, '/usr/include/stdint.h' typedefs int32_t as long. The same file > > on my Linux partition typedefs it to int. I must admit, I don't know what > > to do now. :-( > > > > Is there a simple solution to this? > > > Change

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
found out from Dave, that isn't a safe solution for references. - Original Message - From: "Eric Blake" Sent: 31 October 2008 13:26 Subject: Re: cygwin g++ strictness On the other hand, gcc 4 may already be causing ABI changes, so maybe this would be appropriate as par

Re: cygwin g++ strictness

2008-10-31 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to John Emmas on 10/31/2008 7:14 AM: > On Cygwin, '/usr/include/stdint.h' typedefs int32_t as long. The same file > on my Linux partition typedefs it to int. I must admit, I don't know what > to do now. :-( > > Is there a simple solut

Re: cygwin g++ strictness

2008-10-31 Thread Tim Prince
John Emmas wrote: > On Cygwin, '/usr/include/stdint.h' typedefs int32_t as long. The same file > on my Linux partition typedefs it to int. I must admit, I don't know what > to do now. :-( > > Is there a simple solution to this? > Change your include file, if you disagree with it being mor

Re: cygwin g++ strictness

2008-10-31 Thread Ralph Hempel
John Emmas wrote: Is there a simple solution to this? In general, no. Writing portable code is hard and requires quite a bit of thought and perhaps more importantly, experience. First, use the strictest possible warning setting on the compiler and strive for warning free compiles. Then what

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- Original Message - From: "Václav Haisman" Sent: 31 October 2008 12:56 Subject: Re: cygwin g++ strictness I mean the -save-temps switch of GCC. Wow - that was really useful. In fact I tracked down the problem..! On Cygwin, '/usr/include/stdint.h' typedefs i

RE: cygwin g++ strictness

2008-10-31 Thread Dave Korn
John Emmas wrote on 31 October 2008 12:35: > - Original Message - > From: "Dave Korn" > Sent: 31 October 2008 12:22 > Subject: RE: cygwin g++ strictness >> >> You are creating temporaries here. If AddTwoInts modifies either of the >> int refe

Re: cygwin g++ strictness

2008-10-31 Thread Václav Haisman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 John Emmas wrote: > - Original Message - From: "Václav Haisman" > Sent: 31 October 2008 11:54 > Subject: Re: cygwin g++ strictness >> >> Try getting preprocessed source to see where int32_t get defined to >&

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- Original Message - From: "Václav Haisman" Sent: 31 October 2008 11:54 Subject: Re: cygwin g++ strictness Try getting preprocessed source to see where int32_t get defined to anything else than typedef of int. I quite like this idea because I can see that this situation i

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- Original Message - From: "Dave Korn" Sent: 31 October 2008 12:22 Subject: RE: cygwin g++ strictness 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.

RE: cygwin g++ strictness

2008-10-31 Thread Dave Korn
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 l

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- 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 v

RE: cygwin g++ strictness

2008-10-31 Thread Dave Korn
John Emmas wrote on 31 October 2008 11:40: > Having said all that, most compilers provide implicit conversions between > related types. Both GCC and MSVC implement the same C and C++ language standards, which define clearly what type conversions are allowed and which are not. Further, the ru

Re: cygwin g++ strictness

2008-10-31 Thread Václav Haisman
-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 &g

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- 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

Re: cygwin g++ strictness

2008-10-31 Thread Václav Haisman
-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. &g

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- 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 S

Re: cygwin g++ strictness

2008-10-31 Thread Václav Haisman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 John Emmas wrote: > - Original Message - From: "Larry Hall (Cygwin)" > Sent: 30 October 2008 22:23 > Subject: Re: cygwin g++ strictness >> >> This is gcc/g++ question, not a Cygwin one. Please find an a

Re: cygwin g++ strictness

2008-10-31 Thread John Emmas
- Original Message - From: "Larry Hall (Cygwin)" Sent: 30 October 2008 22:23 Subject: Re: cygwin g++ strictness This is gcc/g++ question, not a Cygwin one. Please find an appropriate forum to ask this question if you can't find it in the available documentation.

Re: cygwin g++ strictness

2008-10-30 Thread Larry Hall (Cygwin)
John Emmas wrote: When compiling things under cygwin I'm noticing that the compiler is very strict about things like typedef'd variables. For example if 'gint' is typedef'd as int and 'int32' is also typedef'd as int I can't pass an int32 to a function that requires gint. This means I'm having

Re: cygwin g++ strictness

2008-10-30 Thread Vaclav Haisman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 John Emmas wrote: > When compiling things under cygwin I'm noticing that the compiler is very > strict about things like typedef'd variables. For example if 'gint' is > typedef'd as int and 'int32' is also typedef'd as int I can't pass an int32 > to