As long as you have a flat address space, this trick works. The problem is (was) for systems with memory segments; in that case, &realarray[-1] might not be valid.
Bill On Mar 30, 2010, at 12:30 PM, Barry Smith wrote: > > What do the PETSc developers think of this? Is it "otherwise, the > behavior is undefined, even if the pointer is not dereferenced."? > > Whenever we work with global indices like in FormFunctionLocal() > we do this. > > Is PETSc wrong to ever do this? Is there any other way to allow > users to work with global indices in a simple way? Do we need to > strip out all the FormFunctionLocals() from PETSc? Not the end of > the world but it provides such a nice simple interface for simple > problems it seems a pity to toss it. > > Thanks > > Barry > William Gropp Deputy Director for Research Institute for Advanced Computing Applications and Technologies Paul and Cynthia Saylor Professor of Computer Science University of Illinois Urbana-Champaign -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100330/efa33ed1/attachment.html>
