[petsc-dev] Allocating arrays

Jed Brown jedbrown at mcs.anl.gov
Sat Nov 30 21:13:21 CST 2013


Barry Smith <bsmith at mcs.anl.gov> writes:
>   PetscNew() is PetscCalloc1(1,&beasty); the original analogy with C++
>   was that it creates a struct and initializes it to zero entries. :-)

But C++ new does not initialize structs.  It does calls constructors for
non-POD types.

>   I’d like to keep it.

Okay, it becomes

  PetscNew(&beasty);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131130/cdc32bda/attachment.sig>


More information about the petsc-dev mailing list