Is there a way in Fortran to omit the size when declaring a named constant array? I just find it unnecessary to count array elements.
I have something like the following in mind
integer, parameter :: a(???) = [1, 2, 1, 2, 1, 4]
What about constant strings?
character(len=???), parameter :: a = "Hello world. This is a very long string."
The obvious solution I see is to just use a really large number here (e.g. 1024) and call trim
on it whenever we want to access it.
This just doesn't seem as nice as it could be...
Note: I think that using the preprocessor (defining preprocessor macro and calling len
on it) is not an elegant way here.