Click here to Skip to main content
13,189,324 members (75,057 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 22 Jun 2005

view the contents of BSTR in debugger? good tips and notes

, 22 Jun 2005
Rate this:
Please Sign up or sign in to vote.
view the contents of BSTR in debugger


First, be sure to enable display of Unicode strings via:

Tools/Options/Debug/Display Unicode strings. This should enable viewing of BSTR types.

Wrappers for BSTR, though, still cause problems.

To display _bstr_t types add this to your \DevStudio\SharedIDE\bin\autoexp.dat file.
_variant_t =vt=<vt,x> str=<bstrVal,su> short=<iVal>
_bstr_t =<m_Data->m_wstr,su>
tagVARIANT =vt=<vt,x> str=<bstrVal,su> short=<iVal>


Difference Between linked list and array

In Linked list, we allocate memory as much as needed at run time while in array we have to allocate memory at compile time.

linklist is dynamic allocation. and array is a static allocation

easy to remove the node of linked list, hard to remove a cell of an array, you have to shift the rest cells, it will be expensive.

You can find data quickly in array as long as specifying the index. However, in linked list, you need start from the header, takes O(N) times.

Array can store only homogeneous content. That is objects of the same type. So type casting is not required

advantages of array over linkedlist is we can access the values arbitarily but in
linked lists we have to access the data sequentially.



C++ templates allow to implement a generic class..code reuse..

The basic syntax for declaring a templated class is as follows:

template <class a_type> class a_class {...};

The keyword 'class' above simply means that the identifier a_type will stand for a datatype. NB: a_type is not a keyword; it is an identifier that during the execution of the program will represent a single datatype. For example, you could, when defining variables in the class, use the following line:

a_type a_var;

and when the programmer defines which datatype 'a_type' is to be when the program instantiates a particular instance of a_class, a_var will be of that type.

When defining a function as a member of a templated class, it is necessary to define it as a templated function:

template<class a_type> void a_class<a_type>::a_function(){...}

When declaring an instance of a templated class, the syntax is as follows:

a_class<int> an_example_class;

An instantiated object of a templated class is called a specialization; the term specialization is useful to remember because it reminds us that the original class is a generic class, whereas a specific instantiation of a class is specialized for a single datatype (although it is possible to template multiple types).

Usually when writing code it is easiest to precede from concrete to abstract; therefore, it is easier to write a class for a specific datatype and then proceed to a templated - generic - class. For that brevity is the soul of wit, this example will be brief and therefore of little practical application.

We will define the first class to act only on integers.

class calc



int multiply(int x, int y);

int add(int x, int y);


int calc::multiply(int x, int y)


return x*y;


int calc::add(int x, int y)


return x+y;


We now have a perfectly harmless little class that functions perfectly well for integers; but what if we decided we wanted a generic class that would work equally well for floating point numbers? We would use a template.

template <class A_Type> class calc



A_Type multiply(A_Type x, A_Type y);

A_Type add(A_Type x, A_Type y);


template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y)


return x*y;


template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)


return x+y;


To understand the templated class, just think about replacing the identifier A_Type everywhere it appears, except as part of the template or class definition, with the keyword int. It would be the same as the above class; now when you instantiate an

object of class calc you can choose which datatype the class will handle.

calc <double> a_calc_class;

Templates are handy for making your programs more generic and allowing your code to be reused later.



nice puzzle

I have a scale and 7 balls. 1 ball is heavier than all the rest. How do I determine the heaviest ball with only 3 possible weighing attempts?

Answer: I can do it in 2 attempts.

1. Take one out.
2. Balance the 6 on the scale, 3 on each side.
3. If they balance, the one sitting out is the culprit
4. If one side goes down, we have narrowed down to 3 balls
5. Take one out. Now balance the two remaining.


































This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
India India
Think good and good will happen...

You may also be interested in...


Comments and Discussions

GeneralDebugging UNICODE strings Pin
kacza23-Jun-05 21:00
memberkacza23-Jun-05 21:00 
Thanks mate, I've been looking for something like this for a while... :->
GeneralRe: Debugging UNICODE strings Pin
Blue_Aqua23-Jun-05 21:10
memberBlue_Aqua23-Jun-05 21:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171016.2 | Last Updated 23 Jun 2005
Article Copyright 2005 by Blue_Aqua
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid