On Tue, May 25, 2010 at 1:03 AM, Yves Caniou <yves.caniou_at_[hidden]> wrote:
> 2 ** When I use a Isend() operation, the manpage says that I can't use the
> buffer until the operation completes.
> What happens if I use an Isend() operation in a function, with a buffer
> declared inside the function?
> Do I have to Wait() for the communication to finish before returning, or to
> declare the buffer as a global variable?
If you declare it inside the function (an auto variable), you're
declaring it on the stack. When the function is over, the stack may be
reused and this is gonna have nasty effects. You don't need to declare
the buffer as a global, just allocate it on the heap (with new or
malloc or whatever), just make sure you don't lose track of it cause
you're probably gonna need to free that memory eventually.