Solved

C++ Memory Reclamation and SQLHSTMT

Posted on 2011-02-18
2
769 Views
Last Modified: 2012-05-11

In my snippet. Is it necessary to delete or initialize the member variable, m_hstmt?
		CString m_SQLString;
		CString m_WhereClause;
		short m_nFields;		// The number of fields in this rowset
		SQLHSTMT	m_hstmt;		// Statement Handle

Open in new window

0
Comment
Question by:TimPeer
2 Comments
 
LVL 4

Accepted Solution

by:
HawyLem earned 500 total points
ID: 34931906
I think not, as you can see:
typedef SQLHANDLE               SQLHSTMT;
typedef void *                          SQLHANDLE; 

Open in new window


it's a void pointer. So no memory disallocation needed. Initialization as any other pointer
0
 

Author Closing Comment

by:TimPeer
ID: 34931915
Excuse my lack of knowledge with void *, what makes them unique that one needn't deallocate if they are allocated? Is the ponter created on the stack and released when complete or...

You get the points, but would appreciate the followup question.

Many thanks!
Tim
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now