[petsc-dev] http://www.c-faq.com/aryptr/non0based.html

Matthew Knepley knepley at gmail.com
Tue Mar 30 13:16:04 CDT 2010


I think it is too useful to give up.

It seems crazy that there would not be OS calls like

  bool validAddress(void *add);

  Matt

On Tue, Mar 30, 2010 at 11:55 AM, William Gropp <wgropp at illinois.edu> wrote:

> 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
>
>
>
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100330/7994f02d/attachment.html>


More information about the petsc-dev mailing list