On 13/03/07, Pete Robbins <[EMAIL PROTECTED]> wrote:



On 13/03/07, Caroline Maynard <[EMAIL PROTECTED]> wrote:
>
> After getting up to date, I'm seeing:
>
> SequenceImpl.cpp
> c:\dev\pecl\sdo\commonj\sdo\sequenceimpl.h(344) : error C4716:
> 'commonj::sdo::SequenceImpl::seq_item::operator=' : must return a value
> NMAKE : fatal error U1077: '"cl.exe"' : return code '0x2'
> Stop.
>
> Now the code in question is
>         // Copy assignment
>          seq_item& operator=(const seq_item& sin)
>          {
>             if (freeText)
>             {
>                delete freeText;
>             }
>             if (sin.freeText != 0)
>             {
>                freeText = new SDOValue(*sin.freeText);
>             }
>          }
>
> which indeed doesn't return a value. I'm just puzzled why this is only
> happening to me. I would raise a JIRA, but it doesn't seem like a VC6
> problem, and I can't see why else it would be different.
>
> --
> Caroline
>


This compiles fine on Linux, Nac


Nac = Mac :-(

and Windows using VC Express (V8?). I assume there is an implied return
*this; at the end which the earlier compiler isn't adding. There is another
problem with this in that a correct implementation should always check
that it is not assigning to itself. This code would fail wih:

seq_item x = blah;

x=x;

It should look something like:

   // Copy assignment
         seq_item& operator=(const seq_item& sin)
         {
           *if(this != sin)*
*          {*
            if (freeText)
            {
               delete freeText;
            }
            if (sin.freeText != 0)
            {
               freeText = new SDOValue(*sin.freeText);
            }
*          }*
*          return *this;*
         }
I'll fix it up

Cheers,
--
Pete




--
Pete

Reply via email to