[gecode-users] LinExp issue with MSVC 9

Filip Konvička filip.konvicka at logis.cz
Thu Mar 20 14:19:59 CET 2008


Guido Tack 20.3.2008 12:54:
> Filip Konvička wrote:
>> It seems that spec() has more arguments in LinBin than in Actor, so the
>> compiler chokes. (Note that the function is not explicitly "virtual" in
>> LinBin.) This is a "Level 4" warning 4263, which I used to have turned
>> into error using, so I wonder whether this should be fixed in Gecode or
>> not. The warning says that LinBin::spec() effectively hides
>> Actor::spec() in LinBin (which might be intentional, of course, but the
>> compiler probably doubts that).
>
> C4263 is one of the warnings that is off by default, that's why we 
> hadn't noticed yet.  I'm not sure what we're going to do about it, the 
> code is perfectly legal C++, and it doesn't cause any problems.  I 
> wouldn't want to rename the function just because of this warning.  
> Does it help to make LinBin::spec virtual itself?  If so, that would 
> be an option.
I doubt that. LinBin::spec() has different arguments and so does not 
override Actor::spec(), but it does hide it. The warning says that the 
design is dangerous, because when you have an instance of LinBin, it 
makes a difference whether you call spec() via LinBin or its base class. 
The question is whether you can make Actor::spec() non-virtual, which 
would IMO solve this. The rationale behind the warning is that since you 
have a 'virtual spec()' in base class, having 'spec()' (virtual or not) 
in a derived class suggests that you wish to override the base class's 
version and allow access to it via the virtual function call mechanism. 
I do agree though that this is quite pedantic...

Cheers,
Filip





More information about the gecode-users mailing list