Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C++ Memory Reclamation and SQLHSTMT

Posted on 2011-02-18
2
Medium Priority
?
798 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

927 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