Difference between "index" in Pragma vs Compiling Tab

On the “Compiling” tab of the project properties, there is an “Index out of range” selection.

But also, in the documentation, there’s an “index” pragma.

Can anyone explain what the difference is?

@anon77170705 ?

Thank you.

No difference. The IDE just provides the UI to set program/source file pragmas. The Project System passes them to compilers in the form described in the documentation.

Thank you, @anon77170705

Actually, there is a difference in compile behavior.

With the #pragma ‘index’, it will give you a duplicate label warning for any variable named “index”. So it is good to know that it can be safely removed from the defines. :slight_smile:

Thanks for your help.

Sounds you do use
#pragma define(index=>on|off)
in the program instead of correct
#pragma check(index=>on|off)

There was “index” in the compile defines vs using the checkbox.

I don’t understand the word “compile” here. If the check(index) pragma is provided in any way, it does not affect declarations in the program with the label Index. If there is an attempt to turn index checking on or off by the define(index) pragma, this can cause errors. The compiler knows some set of define pragmas and just sets its internal values to passed values if these pragmas are provided. If the compiler meets the define pragma with unknown identifier before => sign and value after => sign is either integer or “on”/“off”, it produces the EQUATE internally. For example, if the pragma
define(_ABCDllMode_=>on)
is set in the project, the compiler produces the declaration
_ABCDllMode_ EQUATE(1)
internally. This allows to use ABCDllMode in CLASS declarations or in conditions for OMIT/COMPILE.

So, if there is a pragma define(index=>on|off) in the project, or it is set using the PRAGMA directive, the compiler produces the declaration
index EQUATE(1|0)
internally, and all following declarations of any variables or statement labels with the identifier index are becoming syntactically wrong.

BTW, It’s impossible to declare a procedure with the index identifier because it would conflict with the INDEX keyword.

test.clw (606 Bytes)

1 Like

Hi @anon77170705 -

I am referring to this scenario:

image

The “Conditional Compilation Symbols” entry is for define pragmas. So, if you write the
index=>1
text there, the Project System produces the
#pragma define(index=>1)
pragma for the compiler. Because the define(check) is not among “standard” define pragmas, the compiler tries to process it just like
index EQUATE(1)

Thank you for the explanation about “check”, @anon77170705. I think I get it now.

1 Like