Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29362 Discussions

Why can't a variable have both the PARAMETER and TARGET attributes?

OP1
New Contributor III
737 Views

I am wondering why these two attributes are not compatible with each other. For instance, I may want to define a series of constants in a module, and then have various pointers point at them.

It's not really a big deal - the only thing is that not declaring my constants as PARAMETERS leave them exposed to potential (erroneous) change of values by the users of my subroutines in their code.

Thanks,

Olivier

0 Kudos
1 Reply
Steven_L_Intel1
Employee
737 Views
A PARAMETER is not a variable. It is a "named constant". This is not the same as C's "const". You can't point at a constant. You could declare a variable with an initial value and declare it PROTECTED, but if it was a target that would not prevent the value from being changed.
0 Kudos
Reply