[Coin-discuss] Bug Report in PackedVectorBase

Laszlo Ladanyi ladanyi at us.ibm.com
Sun Oct 5 11:27:37 EDT 2003


Hi Leo,

Actually, I believe that MSVC 2003 is at fault. The binaryOp methods are
templated methods and the compiler has no business in compiling them until it
knows the template arguments. What I think is that MSVC 2003 tries to be
clever and precompile those parts of the method that do not depend on the
template argument. But that's a problem with the compiler. Also, Sun's CC,
IBM's xlC, HP's aCC compile the code without any problems...

This raises the issue of how do we deal with bugs in Microsoft's compilers?
(The question is valid regardless of whether MSVC 2003 is at fault now or
not.) To get wide audience, we need them to compile our code. But that would
be sort of letting the bully to win. (The bully's compiler is faster, but only
because it cheats on the rules, but we can't do anything about it, so we
conform...)

In this particular case moving binatyOp into the PackedVector class is not the
right solution either. If we did that we couldn't use ShallowPackedVectors in
binaryOps.

A possible solution would be to move binaryOp into CoinPackedVector.hpp as a
templated function (not a method in PackedVector. This actually makes sense,
after all, the does function return a PackedVector...

What do people think? (On both questions.)

--Laci

On Sat, 4 Oct 2003, Leo Lopes wrote:

> Dear Laszlo,
> 
> 	I was having trouble compiling the basic COIN library under the newest 
> VS .net (I know, I know), and I noticed you were the last to update 
> CoinPackedVectorBase and CoinPackedVector. I'd like to point out a 
> feature of that code that is causing a problem. It is on lines 164, 182, 
> and 200, and the couple of lines following each case. MSVC 2003 
> complains about this code even though gcc and the previous MSVC don't, 
> and I think at least this time MSVC 2003 is right.
> 
> 	The problem is the following: when compiling PackedVectorBase, a 
> compiler has no way of knowing that PackedVector has a 
> setTestForDuplicateIndex method. It doesn't know, at this point, that 
> PackedVector is a child of PackedVectorBase. My guess is that the code 
> as it is now only works in gcc and the old MSVC because of the mechanism 
> that gcc and MSVC use to implement templates.
> 
> 	I changed PackedVectorBase and PackedVector so that any references to 
> PackedVector are removed from its parent, PackedVectorBase. This 
> involved moving the binaryOp functions to PackedVector and changing some 
> signatures. This allowed the Coin library ato compile cleanly under MSVC 
> and gcc and Clp to compile cleanly under gcc. I haven't tried other 
> libraries/compilers combinations yet.
> 
> 	The sources I am sending you are not changes of the absolute newest 
> versions in the CVS. However the same holds true of those versions.
> 
> Cheers,
> Leo.
> 
> Laszlo Ladanyi wrote:
> > I think I caught all memory problems. At least now valgrind is quiet. It
> > wasn't too bad, various pointers got deleted multiple times. I think there are
> > memory leaks left. I'll try to deal with them over the weekend or early next
> > week.
> > 
> > All the changes are committed. 
> > 
> > Thanks for the bug report!
> > --Laci
> > 
> > 
> > _______________________________________________
> > Coin-discuss mailing list
> > Coin-discuss at www-124.ibm.com
> > http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss
> 
> -- 
> =======================================================================
> Leonardo B. Lopes                                   leo at sie.arizona.edu
> Visiting Assistant Professor                              (520)626-1780
> SIE - University of Arizona
> 




More information about the Coin-discuss mailing list