Reference-LAPACK / lapack

LAPACK development repository
Other
1.49k stars 436 forks source link

Adding argument intents #894

Open Beliavsky opened 1 year ago

Beliavsky commented 1 year ago

A few source files have procedures with argument intent, but most do not. If someone goes through the source files, correctly adds argument intents, and submits a PR, will such a PR be accepted? Strictly speaking such changes do not increase functionality, and they probably won't improve performance, but they should not break anything if add judiciously. I see 30 files with argument intent in src/SRC, listed below. In that directory there are 2051 files with the .f or .f90 extension.

cgedmd.f90 cgedmdq.f90 claqz0.f claqz1.f claqz2.f claqz3.f dgedmd.f90 dgedmdq.f90 disnan.f dlaisnan.f dlaqz0.f dlaqz1.f dlaqz2.f dlaqz3.f dlaqz4.f sgedmd.f90 sgedmdq.f90 sisnan.f slaisnan.f slaqz0.f slaqz1.f slaqz2.f slaqz3.f slaqz4.f zgedmd.f90 zgedmdq.f90 zlaqz0.f zlaqz1.f zlaqz2.f zlaqz3.f

martin-frbg commented 1 year ago

the ones with "intent" were (somewhat) recently added or (partly) rewritten, where it makes sense to use modern idioms (even if only because that is what the author is familiar with). If the intent of adding intent is only to make legacy code appear modern, I'm not convinced - if however this makes it easier for tools to find bugs in the code...

Beliavsky commented 1 year ago

The main benefit of adding argument intents would be to clarify to the user which arguments are inputs, outputs, or both. The documentation has this information, but ideally it would be in the code itself, so that the code is self-documenting. Documentation is sometimes wrong, whereas argument intents are checked by the compiler.

weslleyspereira commented 1 year ago

I like the idea of improving the documentation. I couldn't find when the intent was introduced. Is this only in Fortran 2003 and newer versions? Mind that LAPACK has only few code written in Fortran 90 free-format style, and I am not sure what we use from Fortran 2003. I believe most files use the Standard Fixed Format style or at least a style very close to this one.