且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

fortran 64位十六进制BOZ

更新时间:2023-11-08 11:57:40

正如弗拉基米尔(Vladimir)在其评论中发布的,integer(kind=8)不可移植(编译器抱怨的也不是16类型).

As Vladimir posted in his comment integer(kind=8) is not portable (and not of kind 16 as the compiler complains).

作为一种补救措施,我建议使用内部模块ISO_Fortran_env(Fortran 2003),该模块具有许多

As a remedy I suggest to use the intrinsic module ISO_Fortran_env (Fortran 2003) which has many predefined constants for the compiler used. Using INT64 from this module solves your problem and results in portable code:

program test
  use,intrinsic :: ISO_Fortran_env, only: INT64
  integer(INT64), parameter :: mask = Z'7FC0000FF80001FF'

  print *,mask
end program