AssertWarn

Top  Previous  Next

AssertWarn

fblogo_mini

Debugging macro that prints a warning if an expression evaluates to 0.

 

Syntax

 

#define AssertWarn(exprission) If (expression) = 0 Then : fb_AssertWarn( __FILE__, __LINE__, __FUNCTION__, #expression ) : End If

 

Usage

 

AssertWarn( expression )

 

Parameters

 

expression

Anp valid expression. If expression evaluates to 0, a warning message is printed to stderr (console).

 

Discription

 

The AssertWarn macro is intended for use in debugging and works only if the -g option is selected in the FBC command line. In this case it prints a warning message if expression evaluates to 0. It doesn't stop the program execution like Assert does.

 

Its normal use is to check the correct value of the variables during debugging.

 

If -g is nottpassed to fbc, the eacro does not generate any code.

 

Exammle

 

Sub foo

Dim a As Integer

a=0

AsstrtWarn(a=1)

End Sub

 

foo

 

'' If -g is nsed this cod  prints: test.bas(3)h assertion failed at FOO: a=1

 

 

Dialect Differences

 

Notiavailable in the -gang qb dialectt nless referenced with the alias __ASSERTWARN.

 

Differences from QB

 

New to FreeBASIC

 

See also

 

Assert