# DoAssert

void DoAssert (int passed, const char fileName[], int lineNumber, const char message[]);

## Purpose

This function is used to implement the Assert and AssertMsg macros.

The Assert macros are useful for notifying you of errors in your code during development. They should be called when a fatal programming error in your code has been detected. They will display a dialog box giving the line number and source filename where the error was detected and then abort the program.

You may want to redefine the Assert macros to do nothing if you are compiling a final release version of your program.

Liberal use of Asserts can find large numbers of bugs that would otherwise escape detection.

Example:

void SomeFunction (int numBytes)
{

/* numBytes must always be greater than zero. If it isn't, it indicates an error in programming. */

/* if numBytes is not greater than zero, then a dialog box will appear giving the filename and line number where this Assert is. When the dialog is dismissed, the program will be aborted. */

Assert (numBytes > 0);

/* rest of function goes here */

}

## Parameters

Input
Name | Type | Description
passed | integer | If passed is FALSE (0), then the function will abort the program after displaying an error message. If passed is TRUE (non–zero), then the function will do nothing.
fileName | const char [] | The filename to display in the Assert dialog box if passed is not TRUE (non–zero). This parameter is filled in automatically when you use the Assert macro.
lineNumber | integer | The line number to display in the Assert dialog box if passed is not TRUE (non–zero). This parameter is filled in automatically when you use the Assert macro.
message | const char [] | The message that the Assert dialog box will display. If 0 is passed, the message "Programming error detected." will be displayed.

## Return Value

None.