[petsc-users] Wrapping PetscFPrintf

Jed Brown jedbrown at mcs.anl.gov
Mon Nov 12 11:41:16 CST 2012

On Mon, Nov 12, 2012 at 1:16 AM, Dominik Szczerba <dominik at itis.ethz.ch>wrote:

> Indeed. The problem was that the functions had to be virtual, so no
> static possible in C++.

Can you check whether the function calling va_start needs to be
static/non-virtual (Print), or just the function that you pass a va_list to
(your VPrint)?

> > It could be compiler-dependent. C++ is not my favorite language.
> I am really curious, what is your favorite language?

Heh, there are very interesting languages that are not terribly practical,
at least for scientific computing. Haskell and Racket come to mind.
Extremely expressive and extensible. There is a very new language called
Julia that I think is a pleasure to work with, though I think it will have
growing pains. Then there are the practical languages like C and Python. If
I were to leave C for a systems language, I would not ask for object
oriented features, I would ask for (1) a proper module system and (2)
native multiple dispatch.

> > PetscSynchronizedVFPrintf is missing, but should be added.
> > (...)
> > There is actually an implementation issue.
> It is possible that I will have to resolve it (by contributing code),
> and therefore I may soon come back for some more pointers.

The problem is that you _can't_ implement the V versions without
vasprintf() or similar because you can't determine the required buffer size
without exhausting the va_list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121112/4fb3537f/attachment.html>

More information about the petsc-users mailing list