View Single Post
  #2 (permalink)  
Old 05-07-2003
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 926
Re: Documentation re: stack-allocated servants

Quote:
Originally posted by greg_hall
Version 1.0.2 of the Ice documentation states in "10.7.1 Instantiating a Servant":

"Instantiating a servant means to allocate an instance, either on the stack or on the heap. Most commonly, servants are instantiated on the heap because we want the servant instance to endure beyond the duration of the current stack frame:"

This is rather misleading in practical terms in the light of the section, "Stack-Allocated Class Instances" in "6.14.5 Smart Pointers for Classes" which states:

"...allocating class instances on the stack is pragmatically useless because all the Ice APIs expect parameters that are smart pointers..."

and goes on to demonstrate the dangers of using stack-allocated classes with smart pointers.

Wouldn't it be better to state in 10.7.1 that servants *must* be allocated on the heap (as with the later CORBA specs) or provide a cross-ref to the appropriate part of 6.14.5? Or can a sensible example of stack-allocated servants be provided in the documentation?

Cheers,

Greg

BTW, a few of the cross-references seem to be broken in 10.7.2-3
Hi Greg! (Long time no talk )

You caught me out there.

Yes, you are right -- allocating servants on the stack is something that's fraught with danger and best not done at all. I'll fix this for the next version of the doc, thanks!

I'll have a look at the broken XREF. Do you have a page number?

Thanks,

Michi.
Reply With Quote