Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

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

OP1
New Contributor III
589 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
589 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