Re: removing performance warnings

2006-06-07 Thread Andre Poenitz
On Tue, Jun 06, 2006 at 10:51:25AM +0200, Abdelrazak Younes wrote: > >Why is it a performance warning? > > Because you loose precision: 32 bits -> 1 bit And that loses performance how? Andre' [Not discussing '32' and '1' here]

Re: removing performance warnings

2006-06-07 Thread Andre Poenitz
On Wed, Jun 07, 2006 at 12:39:04AM +0200, Peter Kümmel wrote: > Lars Gullik Bjønnes wrote: > > > | Obviously, I'm in a pedantic mood. These two are casts: > > |(bool)1; > > |static_cast(1); > > | This one isn't: > > |bool(1); > > > > I think I still prefere this last one. > > When we

Re: removing performance warnings

2006-06-07 Thread Andre Poenitz
On Sun, Jun 04, 2006 at 02:06:50PM +0200, Peter Kümmel wrote: > Index: DepTable.C > === > --- DepTable.C(Revision 13994) > +++ DepTable.C(Arbeitskopie) > @@ -253,5 +253,5 @@ > } > deplist[nom

Re: removing performance warnings

2006-06-07 Thread Andre Poenitz
On Sun, Jun 04, 2006 at 02:06:50PM +0200, Peter Kümmel wrote: > And here a patch which removes a lot of > warning about performance Btw MSVC's 'performance warnings' when usinh int in place of bools are bogus. Should be silenced on the command line. Andre'

Re: removing performance warnings

2006-06-07 Thread Andre Poenitz
On Tue, Jun 06, 2006 at 09:40:27AM +, Angus Leeming wrote: > Abdelrazak Younes <[EMAIL PROTECTED]> writes: > > > | > (the warning was: > > > | > ..\..\lyx-devel\src\lyxtextclass.C(1065) : warning C4800: 'int' : > > > | > forcing value to bool 'true' or 'false' (performance warning) > > > | > )

Re: removing performance warnings

2006-06-06 Thread Peter Kümmel
Lars Gullik Bjønnes wrote: > Peter Kümmel <[EMAIL PROTECTED]> writes: > > | When we use a C compiler then it uses the C-style cast (bool), > | so I think the correctest way is to use static_cast, > | but this is so ugly that I would prefer (bool). > > C-style casts are just too powerful... don't

Re: removing performance warnings

2006-06-06 Thread Lars Gullik Bjønnes
Peter Kümmel <[EMAIL PROTECTED]> writes: | When we use a C compiler then it uses the C-style cast (bool), | so I think the correctest way is to use static_cast, | but this is so ugly that I would prefer (bool). C-style casts are just too powerful... don't use them. | I'm not sure if the bool con

Re: removing performance warnings

2006-06-06 Thread Peter Kümmel
Lars Gullik Bjønnes wrote: > | Obviously, I'm in a pedantic mood. These two are casts: > |(bool)1; > |static_cast(1); > | This one isn't: > |bool(1); > > I think I still prefere this last one. When we compile with a C++ compiler then it casts with a static_cast a int to bool, therefo

Re: removing performance warnings

2006-06-06 Thread Peter Kümmel
Lars Gullik Bjønnes wrote: > Why is it a performance warning? It means: be careful, it will be maybe too fast :)

Re: removing performance warnings

2006-06-06 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Testing this out on: | * an x86 box running Windows and compiling with MSVC2005 | * an x86 box running Linux and compiling with g++ 4.0.2 | * a 64 bit Dec Alpha box running Linux and compiling with g++ 4.0.3 | | All three produce the output: | sizeof(bo

Re: removing performance warnings

2006-06-06 Thread Angus Leeming
Abdelrazak Younes <[EMAIL PROTECTED]> writes: > > | > (the warning was: > > | > ..\..\lyx-devel\src\lyxtextclass.C(1065) : warning C4800: 'int' : > > | > forcing value to bool 'true' or 'false' (performance warning) > > | > ) > > Why is it a performance warning? > Because you loose precision: 32 bi

Re: removing performance warnings

2006-06-06 Thread Lars Gullik Bjønnes
Abdelrazak Younes <[EMAIL PROTECTED]> writes: | > | Ain't C++ funky? ;-) | > | | > (the warning was: | > | > ..\..\lyx-devel\src\lyxtextclass.C(1065) : warning C4800: 'int' : | > | > forcing value to bool 'true' or 'false' (performance warning) | > | > ) | > Why is it a performance warning? | | B

Re: removing performance warnings

2006-06-06 Thread Abdelrazak Younes
Lars Gullik Bjønnes wrote: Angus Leeming <[EMAIL PROTECTED]> writes: | Peter Kümmel <[EMAIL PROTECTED]> writes: | > > Yes, it's MSVC. It's a performance warning about possibly loosing | > > precision due to the automatic cast. You can get rid of the warning via | > > an explicit cast. | > > |

Re: removing performance warnings

2006-06-05 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Peter Kümmel <[EMAIL PROTECTED]> writes: | > > Yes, it's MSVC. It's a performance warning about possibly loosing | > > precision due to the automatic cast. You can get rid of the warning via | > > an explicit cast. | > > | > > + return bool(provi

Re: removing performance warnings

2006-06-05 Thread Lars Gullik Bjønnes
Peter Kümmel <[EMAIL PROTECTED]> writes: | And here a patch which removes a lot of | warning about performance and some | signed/unsigned mismatches. What compiler is this Ãand what warnings do you actually see? In particualr the performance warnings. It seems that you compiler is to chatty. T

Re: removing performance warnings

2006-06-04 Thread Peter Kümmel
Angus Leeming wrote: > Peter Kümmel <[EMAIL PROTECTED]> writes: >>> Yes, it's MSVC. It's a performance warning about possibly loosing >>> precision due to the automatic cast. You can get rid of the warning via >>> an explicit cast. >>> >>> + return bool(provides_ & p); >> Yes, that's a better

Re: removing performance warnings

2006-06-04 Thread Angus Leeming
Peter Kümmel <[EMAIL PROTECTED]> writes: > > Yes, it's MSVC. It's a performance warning about possibly loosing > > precision due to the automatic cast. You can get rid of the warning via > > an explicit cast. > > > > + return bool(provides_ & p); > > Yes, that's a better solution. It's cer

Re: removing performance warnings

2006-06-04 Thread Peter Kümmel
Abdelrazak Younes wrote: > Angus Leeming wrote: >> Georg Baum <[EMAIL PROTECTED]> writes: - return provides_ & p; + return (provides_ & p) != 0; } >> >>> I have the feeling that you will get objections for things like this >>> from others. >> >> Ceratinly, it seems unnce

Re: removing performance warnings

2006-06-04 Thread Abdelrazak Younes
Angus Leeming wrote: Georg Baum <[EMAIL PROTECTED]> writes: - return provides_ & p; + return (provides_ & p) != 0; } I have the feeling that you will get objections for things like this from others. Ceratinly, it seems unncesessary. C++ (unlike C#) has an implicit cast from int

Re: removing performance warnings

2006-06-04 Thread Angus Leeming
Georg Baum <[EMAIL PROTECTED]> writes: > > + return deplist.size() != 0; > > We use > + return !deplist.empty(); > all over the place. Right. And using "empty()" is often much faster than "size() != 0", so it's a good habbit to get into. > > - return provides_ & p; > > +

Re: removing performance warnings

2006-06-04 Thread Georg Baum
Am Sonntag, 4. Juni 2006 14:06 schrieb Peter Kümmel: > And here a patch which removes a lot of > warning about performance and some > signed/unsigned mismatches. I see the signed/unsigned things, but which changes should have something to do with performance? Which compiler is that? > Index: D

Re: removing performance warnings

2006-06-04 Thread Abdelrazak Younes
Peter Kümmel wrote: And here a patch which removes a lot of warning about performance and some signed/unsigned mismatches. They all seems safe. Abdel.

removing performance warnings

2006-06-04 Thread Peter Kümmel
And here a patch which removes a lot of warning about performance and some signed/unsigned mismatches. Peter Index: DepTable.C === --- DepTable.C (Revision 13994) +++ DepTable.C (Arbeitskopie) @@ -253,5 +253,5 @@ }