- From: ANOQ of the Sun <anoq@vip.CyberCity.dk>
- Date: Tue, 07 Jul 1998 00:42:46 +0200
- To: DOM List <www-dom@w3.org>
Hi! Duncan Grisby from ORL (the creators of omniORB), has warned me about using wstring in my IDL code for the reasons listed below. Please consider using sequences of unsigned short instead of wstring in the DOM spce: Duncan Grisby wrote: > As for wchar and wstring support in omniORB, it's been done, and > should be publicly available soon. However, I would advise sticking to > a sequence of unsigned shorts for a couple of reasons. Firstly, > sequences give you a length field, and bounds checking on member > access, which you don't get with string or wstring. > > Secondly, the CORBA wchar spec is a complete mess -- the on-the-wire > format is defined to be anything between 1 and 4 bytes per character, > or variable bytes per character; the language mapping is system- > specific -- on Solaris, wchar maps to a 4-byte character, but on > Windows it's 2 bytes, so as to fit in with system libraries. I don't > think Linux has sufficient support for such things for it to be > defined at all. All in all, there's _lots_ of overhead to wchar, which > I think is best avoided. The (non-)overhead of using a sequence of unsigned long: > The overhead should be quite small, especially if the optimiser is > good. If you think the overhead of the bounds checking is too much, > you can get at the C++ array inside the sequence with the proprietary > NP_data() function. (NP stands for non-portable. Look at > omniORB2/seqtemplates.h.) The CORBA spec has no such function, but > most ORBs allow you to do it. With a bit of macro cleverness, you > could make the code portable between ORBs. > > Doing this, you still get the advantage that you know the length of > your wstring without having to iterate over its members. > > The relevant bits of the spec are at: > > ftp://www.omg.org/pub/docs/formal/98-02-08.pdf page 25 > and > ftp://www.omg.org/pub/docs/formal/98-02-18.pdf pages 5, 6, 10, 11 Cheers -- , ANOQ of the Sun / Johnny Andersen E-Mail: anoq@vip.cybercity.dk or anoq@berlin-consortium.org Homepage: http://users.cybercity.dk/~ccc25861/
Received on Monday, 6 July 1998 18:47:08 UTC