Undocumented behaviour of Critical state in #If Expressions

Share your ideas as to how the documentation can be improved.
2_05
Posts: 31
Joined: 09 May 2018, 10:28

Undocumented behaviour of Critical state in #If Expressions

06 Oct 2020, 09:57

I was running some tests on setting priority for functions called by #If [Expression]. I then noted that #If Expressions are already executed with priority. I cannot find this anything on this in the documentation of Critical or #If.
It makes sense that #If expressions have priority by default but I cannot find anything on this behavior in the documentation.

Code: Select all

Critical
try FileAppend, Autoexecute Critical on: %A_IsCritical%`n, *
Critical, Off
try FileAppend, Autoexecute Critical off: %A_IsCritical%`n, *
return

#If iftest()
	^D:: MsgBox, Critical: %A_IsCritical%
#If

iftest()
{
	try FileAppend, If Expression Critical: %A_IsCritical%`n, *
	return true
}
Output:
Autoexecute Critical on: 16
Autoexecute Critical off: 0
If Expression Critical: 5

MessageBox output is 0 as expected.
lexikos
Posts: 9599
Joined: 30 Sep 2013, 04:07
Contact:

Re: Undocumented behaviour of Critical state in #If Expressions

09 Oct 2020, 03:42

That is correct; the #If expression is evaluated as a new thread, with Critical in effect.

I have moved the topic to the documentation subforum.

Return to “Suggestions on Documentation Improvements”

Who is online

Users browsing this forum: No registered users and 17 guests