开发者

Can we create custom attributes in fortran?

开发者 https://www.devze.com 2023-02-28 05:06 出处:网络
Expanding on my previous question here, I want to know if is possible to create custom attributes in fortran ?

Expanding on my previous question here, I want to know if is possible to create custom attributes in fortran ?

开发者_Python百科

something like this

real, custom_attribute, allocatable :: variable(:)

If that can be done, I am guessing the following can be done too

custom_type, custom_attribute, allocatable :: variable(:)


You can create user-defined "types". Probably you can accomplish your goal with this feature. See http://en.wikipedia.org/wiki/Fortran_95_language_features#Derived_data_types


No, there is no such thing as custom attributes in standard Fortran. However extending M. S. B.s answer, when using derived data types you can use parameterized derived types, which was introduced with Fortran 2003. It allows you to define "kind" and "len" attributes for the derived data types. This enables you to do something like: type(my_type(rk=selected_real_kind(15), extent=size(a))) :: b

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号