[omniORB] Re: strange omniidl c++ result

Rene Jager renej_frog at users.sourceforge.net
Sun Jul 11 02:12:44 BST 2004


On Sat, 2004-07-10 at 15:56, Maks Verver wrote:
> 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).

Pssible, but I think the intention is to have the declared as inline
functions. See the other comparable function definitions in generated
headers: there are declared as "static inline", the ones that give the
warnings are just "static". So I think the only thing that is missing is
"inline". Whether they are declared as "static inline" or just "inline"
is not really relevant (although there is a difference). It is relevant
that free non-template function definitions in header files should at
least be declared "inline" to avoid warnings like this.
For detailed info on "inline" vs "static inline" vs "extern inline" see
http://www.greenend.org.uk/rjk/2003/03/inline.html

renej

> 
> 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.
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
-- 




More information about the omniORB-list mailing list