xsharp.eu • Warning XS9073
Page 1 of 1

Warning XS9073

Posted: Thu Oct 07, 2021 11:58 am
by leon-ts
Hi,

In what case does the compiler generate warning XS9073 instead of error XS0103 if the variable is not declared?

XS9073: Variable 'SomeVariable' has not been declared. Assuming this is a FIELD or a MEMVAR.
XS0103: The name 'SomeVariable' does not exist in the current context.

In one of my applications, when I compile a line of code that uses a non-existent variable, I get a warning instead of an error. This confused me. I made a separate example with a similar situation and the compiler generated an error as I expected. In both cases, the "/memvar" option is enabled in the project.

Best regards,
Leonid

Warning XS9073

Posted: Thu Oct 07, 2021 1:48 pm
by robert
Leonid,
I would expect that this is a warning only when the compiler option "Allow Undeclared variables" (/undeclared) is enabled. Otherwise this should generate an error.

Robert

Warning XS9073

Posted: Thu Oct 07, 2021 2:02 pm
by leon-ts
Robert,
Indeed! Many thanks!

Best regards,
Leonid