Page tree

Skip to end of metadata
Go to start of metadata

By default, Insure++ will check for bugs for the entire duration of your program. If you are only interested in a portion of your code, you can make some simple, unobtrusive changes to the original source to achieve this.

When you compile with insure, the __INSURE__ pre-processor symbol is automatically defined. This allows you to conditionally insert calls to enable and disable runtime checks.

For example, assume that you are not interested in events occurring during the execution of a function called grind_away. You can disable checking during this function by modifying the code as shown below:

void grind_away() {
	#ifdef __INSURE__
			//disables Insure++ checking
		... code ...
	#ifdef __INSURE__
			//enables Insure++ checking

After modifying the code, Insure++ will not check for bugs between the calls to _Insure_checking_enable when you compile and run your program.

If you do not want to modify the code for the grind_away function, you can add calls to _Insure_checking_enable around the calls to grind_away.

Every call to disable checking should be balanced by a call to enable checking. You should, therefore, be wary of using this function with exceptions, such as longjmp, and so on.

The Insure++ runtime library will continue to record memory allocations and deallocations while checking is disabled. Thus, disabling checking does not affect the runtime library's knowledge of a program's memory usage.

  • No labels