On 1 October 2010 10:17, Chris Morley <c.mor...@gaseq.co.uk> wrote: > On 01/10/2010 09:26, Noel O'Boyle wrote: >> Hi Chris, >> >> I noticed that you have disabled the warning on forcing int etc. value >> to bool 'true' or 'false' (performance warning). >> >> Are you sure this is a good idea? I think each of these is a logic >> error and should be corrected. If a function is supposed to return a >> bool, and attempts to return an int, there's something up. >> >> - Noel > > I don't think that this is a logic error. You would get it with this > code (which is, I think, a longstanding normal C++ idiom): > > int i = 3; > while(i) { > ... > --i; > } > > To avoid the warning you would have to write while(i!=0).
Well, you could have been right, but I just checked and there is no warning compiling this code. The errors we actually see are all related to the return types being specified as bool, while an int or unsigned int is returned, e.g. ..\..\openbabel\src\stereo\perception.cpp(1315) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) I don't want to labour the point as I've already passed these warnings onto Tim, but I think that there is an error is in the original code and it should explicitly return a bool. > The compiler will give an error, rather than a warning, if the value > cannot be implicitly converted to a bool, for real logic errors. > > Actually, a more dangerous warning being ignored is logic comparisons > between signed and unsigned integers. There are a lot of those. Maybe if these were unsuppressed we could at least avoid increasing the number...but if there are a large number of these and we are going to ignore the problem, other warnings might get ignored also. One for MolCore? :-) > Chris > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > OpenBabel-Devel mailing list > OpenBabel-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-devel > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel