[petsc-dev] Compliant C89

Barry Smith bsmith at mcs.anl.gov
Mon Jan 14 12:57:41 CST 2013


On Jan 14, 2013, at 11:33 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Mon, Jan 14, 2013 at 11:17 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Note that even if you change it to an inline function it still will not give the correct stack frame since it is not inside the PetscFunctionBegin/End.
> 
> The point is that an inline function routine couldn't be called in a declaration, so it would force people to move it.

   Ok, I didn't realize inline functions can't be called in a declaration. 

    If that is the case then I am fine with changing to an inline and thus forcing it always out of declarations.

  Barry

> You're right that it looks like it was only used incorrectly in the places fixed here.
> 
> https://bitbucket.org/petsc/petsc-dev/commits/59c614dd5ce57f9497e794f6495fc91990a89274
>  
> 
>   Shouldn't we simply ban its use in the declarations part of the routines?
> 
> I thought it was already banned and that nobody was paying attention, sort of like the // comments.
>  
> Note that its use in, for example,
> 
>     } else {
>       PetscBLASInt ione = 1;
>       PetscScalar aone = 1.0, azero = 0.0;
>       PetscBLASInt neqs = PetscBLASIntCast(bcgsl->ell-1);
> 
> is legal since it is within a PetscBegin/Return block and the last declaration given.
> 
> A quick etags search found that it is being used correctly already almost anywhere. The suspicious place is only in the documentation :-)
> 
> Thus I say, fix the documentation and check that it is never used incorrectly but don't change its form.
> 
> 




More information about the petsc-dev mailing list