> PetscCall in C doesn’t actually “call” the function that is in its arguments, 
> but rather “checks” the called function’s return 

The most logical form would have been `PetscCheck()` but we unfortunately we 
had just recently added it as a replacement for

```
if (error) SETERRQ()
``` 

So the idea instead was to have a `PetscSafeCall()` but with less typing. It 
also fit with the previous `PetscStackCall()` family. You can find the naming 
discussion here 
https://gitlab.com/petsc/petsc/-/merge_requests/4889#note_854556084

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On Apr 26, 2022, at 20:18, Boyce Griffith <boy...@gmail.com> wrote:
> 
> 
> 
>> On Apr 26, 2022, at 8:12 PM, Barry Smith <bsm...@petsc.dev 
>> <mailto:bsm...@petsc.dev>> wrote:
>> 
>> I didn't like PetscCall(ierr) in Fortran because it is strange, even 
>> freakish. PetscCall(AFunction(args)) makes sense in C but IMHO "call 
>> AFunction(args,ierr); PetscCall(ierr)" looks weird, what are you calling? 
>> Nothing. I'd like to keep CHKERRQ(ierr) in Fortran and not support 
>> PetscCall(ierr) in Fortran. 
> 
> I have to admit that I don’t really understand the C usage either, since 
> unless I am misreading the code, PetscCall in C doesn’t actually “call” the 
> function that is in its arguments, but rather “checks” the called function’s 
> return value.
> 
> — Boyce

Reply via email to