[omniORB] omniEvents 2.6.1 install error on irix6

Maks Verver m.verver at student.utwente.nl
Fri Apr 22 15:50:28 BST 2005


Hi,

On Friday 22 April 2005 13:00, omniorb-list-request at omniorb-support.com wrote:
> On 21 Apr 2005, at 10:06, caoy wrote:
> > Now there is only one error in EventChannel.cc ,line 156:
> > output(WriteLock().os);
> > The CC compiler said that the initial value of a reference to a
> > non-const must be on lvalue, WriteLock().os.
> >
> > WriteLock is defined as a class in omniEventsLog.h ,right? I just
> > don't understand what's means about WriteLock().
> >
> > Any suggestion?
>
> Are you using an old compiler? That line should work, but it is being a
> bit clever-clever. WriteLock() constructs a temporary object of type
> WriteLock. It survives while the output() method is executing, and it
> is then destroyed.

No, actually, the IRIX compiler is right and some others are broken. I would 
expect GCC 3 to produce the same error (although I didn't actually test it 
with omniEvents).

The thing is that temporaries are always const objects. Therefore, 
WriteLock().os is a const object and cannot be passed to output() which 
expects a non-const reference argument.

I know there are some older compilers which are forgiving about this (I 
suppose there is no compelling implementation-technical reason to make 
temporaries const); probably you are using one of them (GCC 2? VC++ 6?)

Your 'alternative' code was correct, though, so that should fix the problem.


Kind regards,
Maks Verver.



More information about the omniORB-list mailing list