Ok, maybe I asked wrong.
How can I understand that MyParam is Defined? Not MyStruct.
After Define MyParam.MyStruct Defined() is always answers False.
TypeOf() MyParam and MyStruct tells that both of them are Structure. (03-1, 03-2, 04).
And question about If or CompilerIf is still bothering me. Why CompilerIf and not If?

It's because there will be less bytes in final executable because compiler will ignore that parts of code where Defined() will answer True but If ... True will be compiled always?
Code: Select all
Structure MyStruct
Param.s
EndStructure
CompilerIf Defined(MyParam, #PB_Structure)
Debug "01-1. Structure 'MyParam' is declared"
CompilerEndIf
CompilerIf Defined(MyStruct, #PB_Structure)
Debug "01-2. Structure 'MyStruct' is declared"
CompilerEndIf
CompilerIf Not Defined(MyParam, #PB_Structure)
Debug "02-1. Structure 'MyParam' is not declared"
Define MyParam.MyStruct
CompilerEndIf
CompilerIf Not Defined(MyStruct, #PB_Structure)
Debug "02-2. Structure 'MyStruct' is not declared"
Define MyParam.MyStruct
CompilerEndIf
Debug "03-1. " + TypeOf(MyParam)
Debug "03-2. " + TypeOf(MyStruct)
Debug "04. " + #PB_Structure
CompilerIf Defined(MyParam, #PB_Structure)
Debug "05-1. Structure 'MyParam' is NOW declared"
CompilerEndIf
CompilerIf Defined(MyStruct, #PB_Structure)
Debug "05-2. Structure 'MyStruct' is NOW declared"
CompilerEndIf
CompilerIf Not Defined(MyParam, #PB_Structure)
Debug "06-1. Structure 'MyParam' is STILL NOT declared"
CompilerEndIf
CompilerIf Not Defined(MyStruct, #PB_Structure)
Debug "06-2. Structure 'MyStruct' is STILL NOT declared"
CompilerEndIf
If Defined(MyParam, #PB_Structure)
Debug "11-1. Structure 'MyParam' is declared"
EndIf
If Defined(MyStruct, #PB_Structure)
Debug "11-2. Structure 'MyStruct' is declared"
EndIf
If Not Defined(MyParam, #PB_Structure)
Debug "12-1. Structure 'MyParam' is not declared"
Define MyParam.MyStruct
EndIf
If Not Defined(MyStruct, #PB_Structure)
Debug "12-2. Structure 'MyStruct' is not declared"
Define MyParam.MyStruct
EndIf
If Defined(MyParam, #PB_Structure)
Debug "13-1. Structure 'MyParam' is NOW declared"
EndIf
If Defined(MyStruct, #PB_Structure)
Debug "13-2. Structure 'MyStruct' is NOW declared"
EndIf
If Not Defined(MyParam, #PB_Structure)
Debug "14-1. Structure 'MyParam' is STILL NOT declared"
EndIf
If Not Defined(MyStruct, #PB_Structure)
Debug "14-2. Structure 'MyStruct' is STILL NOT declared"
EndIf