Skip to content

Remove FLOAT and CMPLX macros

This requires choosing how to define the precision.

There are currently three proposals:

  • Option A: use the real64 and int32 parameters defined in the iso_fortran_env standard module:
program
  use iso_fortran_env
  real(real64) :: var_a
  integer(int32) :: var_b
end program
  • Option B: use the parameters from the iso_fortran_env standard module, but alias them:
module kinds
  use iso_fortran_env
  integer, parameter :: r8 = real64
  integer, parameter :: i4 = int32
end module

program
use kinds
real(r8) :: var_a
integer(i4) :: var_b
end program
  • Option C: use the real64 and int32 parameters defined in the iso_fortran_env standard module and alias them at the module level:
module module_oct_m
  use iso_fortran_env, only: wp=>real64, i8=>int32

  real(wp) :: var_a
  integer(i8) :: var_b
end module

Some pros and cons:

  1. Option A:
  • variable declaration is longer
  • no need to define the aliases in a module and use that module everywhere in the code
  • easier to extract parts of Octopus and make them into libraries
  1. Option B:
  • variable declaration is shorter
  • possible name clash with other libraries that also define the same aliases
  1. Option C:
  • short variable declaration
  • no need to define the aliases in a module and use that module everywhere in the code
  • easy to change the precision at the module level
  • easier to extract parts of Octopus and make them into libraries
  • need to declare the aliases in all modules

It would be good to have the opinion of as many developers as possible. Also, feel free to point out other advantages and disadvantages of the options.

Edited by Micael Oliveira