[cable] rather sporadic error messages

Bertram Herzog bertram at bwh.harvard.edu
Thu Mar 27 20:17:54 EST 2003


Hi fellow cabler's:

As the project grows, Visual C++ 6 suddenly throws rather weird 
error-messages at me: in the cable-generated .cxx files sometimes appear 
compile-errors within the case-statements of the sections that wrap 
structs or enumerations in the original code.
One for example is:
----------
template <>
struct ReturnEnum< DVPSDisplayTransform >
{
  static void From(const DVPSDisplayTransform& result,
                   const WrapperFacility* wrapperFacility)
    {
    const char* name=0;
    switch (result)
      {
      case ::DVPSD_CIELAB: name = "::DVPSD_CIELAB"; break;
      case ::DVPSD_GSDF: name = "::DVPSD_GSDF"; break;
      case ::DVPSD_first: name = "::DVPSD_first"; break;                 
             (1)
      case ::DVPSD_max: name = "::DVPSD_max"; break;
      case ::DVPSD_none: name = "::DVPSD_none"; break;                
            (2)
      }
    Tcl_SetObjResult(wrapperFacility->GetInterpreter(),
                     Tcl_NewStringObj(const_cast<char*>(name), -1));
    }
};
----------
As far as I can see there is nothing wrong with this generated 
statement. However, Visual C gives the following error:
"error C2196: case value '0' already used", which directs at the (1) 
line, and
"error C2196: case value '2' already used", which directs at the (2) line.

When I had this error earlier, I can only assure that all strings 
mentiones in the line do only appear once in the file and are used 
lateron in the statement
"wrapperFacility->SetEnumerationConstant(
    "::DVPSD_none", new DVPSDisplayTransform(::DVPSD_none),
    CvType< DVPSDisplayTransform >::type.GetType());"

(The distance between those two lines is roughly 30500 lines, the whole 
generated file is 1555 kB in size!)

Having checked out the definition of a "case-value ... already used" 
error, I don't see a reason why this is raised!

Any thoughts about this rather weird behaviour?

Thanks for your thoughts,
   Bertram Herzog.





More information about the cable mailing list