Search

ParaSoft

HOME
PRODUCTS
SUPPORT
ABOUT
WHAT'S NEW
EVENTS


Insure++

Quick facts

Add-on Modules:
   -INUSE
   -TCA

Comparisons

Technical Papers

Support & Manuals

FAQs

Recent Reviews

User Testimonials

Press Releases


Insure tool to debug c++





Insure++ Reference - FUNC_UNINIT_PTR



FUNC_UNINIT_PTR

Function pointer is uninitialized

This error is generated when a call is made through an uninitialized function pointer.

Problem

This code attempts to call a function through a pointer that has not been set.


	1:	/*
	2:	 * File: funcuptr.c
	3:	 */
	4:	main()
	5:	{
	6:		void (*a)();
	7:
	8:		a(); bug
	9:		return (0);
	10:	}

Diagnosis (at runtime)


	[funcuptr.c:8] **FUNC_UNINIT_PTR**
1.	>> 		a();
	
2.		Function pointer is uninitialized: a

		Stack trace where the error occurred:
3.				 main() funcuptr.c, 8
	
4.		**Memory corrupted. Program may crash!!**


  1. Source line at which the problem was detected.
  2. Description of the problem and the expression that is in error.
  3. Stack trace showing the function call sequence leading to the error.
  4. Informational message indicating that a serious error has occurred which may cause the program to crash.

Repair

This problem normally occurs because some assignment statement has been omitted from the code. The current example can be fixed as follows


	extern void myfunc();

	main()
	{
	      void (*a)();
	      a = myfunc;
	      a();
	}


< FUNC_NULL > FUNC_WILD
Tools to debug c++ and java
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft