[omniORB] Re: strange omniidl c++ result

Maks Verver m.verver at student.utwente.nl
Sat Jul 10 16:56:03 BST 2004


Hi Rene,

The behaviour you experienced is caused by the IDL compiler putting function 
definitions in the header files (instead of in the source files).

On Saturday 10 July 2004 13:00, Rene Jager wrote:
> Generates c++ code that gives the following warning:
>
> Test.hh:120: warning: `Array2_slice* Test2::Array2_alloc()' defined but not
>    used
> Test.hh:121: warning: `Array2_slice* Test2::Array2_dup(const
> Array2_slice*)' defined but not used
> Test.hh:122: warning: `void Test2::Array2_copy(Array2_slice*, const
>    Array2_slice*)' defined but not used
> Test.hh:123: warning: `void Test2::Array2_free(Array2_slice*)' defined but
> not used
> This because in the generated lines:
>
>   static Array2_slice* Array2_alloc() { return Test::Array_alloc(); }
>   static Array2_slice* Array2_dup(const Array2_slice* p) { return
> Test::Array_dup(p); } static void Array2_copy( Array2_slice* _to, const
> Array2_slice* _from ) { Test::Array_copy(_to, _from); } static void
> Array2_free( Array2_slice* p) { Test::Array_free(p); }
>
> "static" should be "inline" IMHO

These function definitions must have static linkage, otherwise they will 
appear as symbols in every object file produced and this would cause linking 
to fail. Therefore, the static keyword must stay and I'm afraid you'll either 
have to live with the warnings or disable them.

One could argue that the functions should be declared inline. I'm not sure why 
they aren't; maybe this has to do with the official CORBA C++ language 
binding. By the way, note that the compiler may just inline these functions 
anyway, even if they are not declared inline, so the performance of your 
application doesn't neccessarily suffer from the absence of this keyword. On 
the other hand, even if the functions were declared inline, the compiler 
might ignore that declaration and not inline them either.

Kind regards,
Maks Verver.



More information about the omniORB-list mailing list