[omniORB] BufferedStream operators

Bruce Visscher visschb@rjrt.com
Wed, 16 Jan 2002 20:22:10 -0500


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Speaking of standards conforming C++ compilers...

I have recently noticed that some early work in omniORB 2 that was done
to make IDL modules work the way they were supposed to on platforms that
have not-quite-conforming C++ compilers has the unfortunate side affect
that now the omniORB headers won't work with a strictly conforming C++
compiler.  At least according to the EDG (Edison Design Group) based
Compaq C++ compiler on OpenVMS.  If you use that compiler with the
"/standard=strict_ansi" qualifier then you get errors like:

  ::operator<<=(_0RL_e,s);
..^
%CXX-E-NOMATCHINGFUN, no instance of overloaded function "operator<<="
          matches the argument list
            argument types are: (CORBA::ULong, MemBufferedStream)
at line number 1121 in file OMNI304ROOT:[include.omniORB3]Naming.hh;2

It turns out that this is because of code like:

class NetBufferedStream {
...

  friend inline void operator>>= (_CORBA_Char a, NetBufferedStream& s) {
    MARSHAL(s,_CORBA_Char,omni::ALIGN_1,a);
  }
...
};

IIRC, I had discussed this case with Compaq's ANSI C++ standard
committee representative and she said that the above operator would
actually be in the scope of NetBufferedStream, not the global scope
according to the final standard.

So, the line of code in Naming.hh that tries to find the ::operator<<=
really is wrong.

I propose that this be fixed by adding a macro
OMNI_REQUIRES_GLOBAL_FRIEND_DECLARATION to be set in CORBA_sysdep.h and
that code like:

#ifdef OMNI_REQUIRES_GLOBAL_FRIEND_DECLARATION

void operator>>= (_CORBA_Char a, NetBufferedStream& s);
void operator<<= (_CORBA_Char& a, NetBufferedStream& s);
...
#endif

be added to omniORB3/bufferedStream.h *prior* to the class declaration.

In fact, I have started working on a patch, but have been a little busy,
but I at least wanted to get this out for discussion.  In fact, the
motivation for this is that the std::auto_ptr that comes with the Compaq
C++ 6.5 compiler works better if you compile with strict_ansi (but,
alas, on OpenVMS you have to then disable more warnings).

Now, I suppose someone will tell me that we should let autoconfig
automagically discover what the compiler on our platform requires...
:-).

Bruce

-- 

Bruce Visscher                                        visschb@rjrt.com

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain;
	name="InterScan_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="InterScan_Disclaimer.txt"

CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.


--------------InterScan_NT_MIME_Boundary--