PDA

View Full Version : OPTION STRICT and the interpretation of it.


ABC123

Marcel Kollenaar
02-17-2007, 09:44 AM
Hi,

I'm using always OPTION STRICT to ensure that I declare all variables I use with the DIM command. But now I'm not so sure about the usefulness of the OPTION STRICT command. Let me give an example:


option strict
a="no"
msgbox(a)

This will cause the error "Variable not found". The '=' (Equals Operator) can be used for assignment and equality testing.


option strict
dim a as C
a="no"
msgbox(a)

This behaves as expected.


There is also the := (Assignment Operator) and assigns a value to a variable.


option strict
a:="no"
msgbox(a)

In this situation there is no error generated even it is not dimmed before.

Another strange thing is that I can put nonsense behind the OPTION clause and does not complain. :confused:


option marcel
a:="no"
msgbox(a)

In case of OPTION STRICT I would expect a warning when I use a variable in an equality test or in an assigment when I didn't dimmed it.

Or am I interpreting it wrong?

CALocklin
02-17-2007, 09:54 AM
Your concern sounds valid to me. Maybe Alpha just forgot to consider the := operator.

And, while putting some other name behind the OPTION command seems to be ignored and does't cause an error, it could allow typing mistakes to go unnoticed. That could result in real errors....
OPTION STRCIT

Marcel Kollenaar
02-20-2007, 04:13 PM
Cal,

The Alpha compiler crew is working on it. :)