115
End Sub
Because of the immediately preceding assignment, the compiler can deduce the Boolean value of the
conditions in both the If and ElseIf statements and will issue a useless-code warning indicating that that
those conditions are always false. The first warning directive disables that warning and the second one
unconditionally enables it. Often, it is undesirable to unconditionally enable a warning after disabling it as
was done in this example. To avoid enabling a warning that was not previously enabled, two variations of
the warning directive are provided to save the current set of enabled warnings (push) and restore them
afterward (pop) instead of unconditionally re-enabling a warning. The syntax for the push and pop
warning directives is illustrated in the modified example below.
Dim b as Byte
Dim i as Integer
Sub Main()
b = 3
#pragma warning(push)
#pragma warning(7 : Off)
If (b > 5) Then
i = 100
ElseIf (b <= 5) Then
i = 10
End If
#pragma warning(pop)
b = 25
End Sub
Note that it is permissible to combine two or more warning directives by separating the warning
specifications using a semicolon. For example:
#pragma warning(push; 7:Off; unused-param:On)
7.3.2 Internal Errors
The compiler may, in unusual circumstances, generate an Internal Error message. This will happen when
it encounters a situation where inconsistencies in internal data structures arise that prevent continued
operation. If you encounter an internal error or a program fault, please report it so that it can be
investigated to see why the problem occurred. If possible, construct the smallest program possible that
still exhibits the problem and submit that program along with the error report. In some cases, you may be
able to work around the problem by turning off all optimization although this is not guaranteed to be
helpful. Still, it may be worth a try to get you past the obstacle while the problem is being addressed.
Problem reports may be emailed to |support@zbasic.net or they may be reported via the Support Forum