[petsc-dev] How to enforce private data/methods in PETSc?

Junchao Zhang jczhang at mcs.anl.gov
Fri Aug 10 16:43:28 CDT 2018


 I met several bugs that remind me to raise this question. In PETSc, object
of type A can arbitrarily access object of type B's data. But designer of B
may later change the meaning of its data (and of course, update B's
interfaces, which are usually local to few files). The designer may think
the job is done, but actually it is not.  He/she has to grep the code to
know where its data members are accessed (that is relatively easy to get)
and what is the contract, for example, is an array assumed to be sorted
(that is hard to know).  With C++, one can use private to minimize data
exposure.

--Junchao Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180810/2fe96df4/attachment.html>


More information about the petsc-dev mailing list