Re: core with unused OUT-structures/strings
- From: Michael Haubenwallner <michael haubenwallner salomon at>
- To: orbit-list gnome org
- Subject: Re: core with unused OUT-structures/strings
- Date: Mon, 02 Jun 2003 18:24:46 +0200
Chris Wareham wrote:
> Michael Haubenwallner wrote:
>
>>
>> when i have OUT-structures, why is it necessary to initialize
>> (MYSTRUCT__alloc) these though i return an error to signal the client
>> not to use them ?
>>
>> If i don't, ORBit2 cores when marshalling such structures by accessing
>> NULL.
>>
>
> The marshaller still expects valid out values, as it can't determine
> that the caller is in error unless you throw an exception. Similarily,
> with Java clients all out values must contain sane defaults even when
> you're returning an error - things like the value of enumerated types
> must be valid.
>
>> Another problem is, if i have Strings in an OUT-structure, and even if
>> i initialize (alloc) the OUT-structure itself, i have to alloc all the
>> strings in the out-structure too or ORBit2 cores on strlen(NULL) when
>> marshalling.
>>
>> I strace'd GIOP-messages of mico-orb for C++, and when not using the
>> out-variables (strings in structures), the returned strings are
>> empty strings here (len=0) and other values are as of memset(,0,).
>>
>
> That could be a consequence of MICO being written in C++ and using a
> string class (either the systems STL or the included mini-stl if I'm not
> mistaken). The constructor of the string class provides a "safe"
> initialisation value I would imagine.
>
>> Is it really necessary to initialize all strings in an OUT-structure
>> with CORBA_string_dup(""), even if they are not used for some reasons ?
>>
>
> That's exactly what I do. Again, I guess it's because the marshaller
> expects valid out values - at least a "" string in this case. I seem to
> recall the OMG specs frown upon NULL values because not all languages
> are expected to have a suitable equivalent.
>
>> If yes, a CORBA/ORBit-function which does this would be appreciated,
>> since it is not always known which strings are in an OUT structure,
>> due to some proprietary abstractions.
>>
>
> Not sure what you mean here. Surely if you have the IDL then you can see
> what structures contain strings?
My IDL contains includes of some different components, which are
all part of one interface structure, and in the servant the call
is distributed to the different components, and the main servant
function does not necessarily know which strings are in the structure
at coding time, it does it know earliest at compile time.
Maybe this is not the best way to join components,
it has grown up for some time.
>
>> Why not default to the empty string if a string is NULL,
>> IMHO would be better than core ?
>>
>
> Chris
Thanks,
Haubi
--
Michael Haubenwallner SALOMON Automation GmbH
Forschung & Entwicklung A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at http://www.salomon.at
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]