[omniORB] SystemException::NP_minorString() returns 0

Rene Jager renej_frog at users.sourceforge.net
Sat Sep 25 21:40:54 BST 2004


On Sat, 2004-09-25 at 19:04, Alex Tingle wrote:
> Hi Duncan,
> 
I (renej) throw in my 2 cents

> SystemException::NP_minorString() returns 0 when the minor string is not
> found in the lookup table. This makes using it a bit awkward. Would it
> hurt to return "" or "unknown minor string" instead?
> 
> Right now I have to test the return value before I can use it:
> 
>   const char* minor( ex->NP_minorString() );
>   if(minor)
>   {
>     cout<<minor<<endl;
>   }
> 
> rather than, simply
> 
>   cout<<ex->NP_minorString()<<endl;
> 
> I expect to have to test the result of a call when it returns `char*',
> but I'd usually expect functions that return `const char*' to always
> give me something I can use.

I'd prefer a string with the minor code instead of "unknown". These
things can be done easily with small inline functions (as I do now).
That way you can also hide the use of NP_* functions.

> What do you think? Is there a reason it's the way it is?
> 

Returning not a 0 ptr would make it harder to detect for the prgrammer
that it is an unknown minor code.

renej
-- 




More information about the omniORB-list mailing list