Sunday, July 30, 2006

mystery behind USES_CONVERSION

Well this guy _alloca allocates memory from the stack and not from the heap,basically used by the USES_CONVERSION macro in the ATL ,leading to the cause of stack-overflow ,wen used inside a loop .This automatically gets freed when it goes out of the function scope .
And the default size of the stack in VC6 is 1MB .

ATL7.0 doesn't have this problem.

Wednesday, July 26, 2006

Scope of namespace

Consider this :-

namespace PPP
CMyclass {
int iPPP;

int CMytest::ExampleNameSpace( PPP:: CMyclass &oTest, int p)
return iPPP;


it takes iPPP from the namespace of the PPP , firstchecks in the scope of CMytest and then in the scope of the std <\b> and then in the scope of the function argument scope .
Popularly known as namelook up rule

Tuesday, July 25, 2006

How to call the constructors in vector

CMyClass(int ,int):- is the default constructor
std::vector <CMyClass> oTest(2,CMyClass(2,3));
The above line will create 2 objects of type CMyClass and calls the constructor with the params 2 and 3.

Sunday, July 16, 2006

Use AfxSetWindowText

Internally this does an GetWindowText and sees wether the text are different and updates only if they are different ,therby saving un-necessary updates,

How easy to delete the linked list in c++

typedef struct _tagLinkedList
_tagLinkedList *pNextLink;
int m_iData;
pNextLink = NULL;


if (pNextLink )
delete pNextLink;
pNextLink = NULL


Saturday, July 08, 2006

Complete list of pseudoregisters


Last error value; the same value returned by the GetLastError() API function

Thread information block for the current thread; necessary because the debugger doesn't handle the "FS:0" format

Undocumented clock register; usable only in the Watch window

Intel CPU registers

@CS, @DS, @ES, @SS, @FS, @GS
Intel CPU segment registers

@ST0, @ST1, @ST2, @ST3, @ST4, @ST5, @ST6, @ST7
Intel CPU floating-point registers

[Table from "Debugging Applications" by John Robbins]

Thursday, July 06, 2006

System Messages

Prefix Message category
ABM Application desktop toolbar
BM Button control
CB Combo box control
CBEM Extended combo box control
CDM Common dialog box
DBT Device
DL Drag list box
DM Default push button control
DTM Date and time picker control
EM Edit control
HDM Header control
HKM Hot key control
IPM IP address control
LB List box control
LVM List view control
MCM Month calendar control
PBM Progress bar
PGM Pager control
PSM Property sheet
RB Rebar control
SB Status bar window
SBM Scroll bar control
STM Static control
TB Toolbar
TBM Trackbar
TCM Tab control
TTM Tooltip control
TVM Tree-view control
UDM Up-down control
WM General window

Taken From MSDN

Wednesday, July 05, 2006

STL warning

Hi , you all might have faced the STL Junk warning to change them to meaningful one you can download the following perl Script and it will convert them to meaningful details .
you can have it from :-

Tuesday, July 04, 2006

Re :Recursion

Hi Folks you might have read my previous mail on recursion ,so here iam presenting one more great way of doing it using class template :-
template <"int N">
class Fact {
enum { value = N * Fact::value };
//Template specialization
class Fact<1> {
enum { value = 1 };

make a obj of Factorial and then retreive the value ,the good thing is no function call is made only expansion at runtime is hapening and its an crisp code ,
Template is very powerful in scientific computing .
You can expect more intresting posts on template shortly.

Monday, July 03, 2006

Bugs in VC6.0

Sometimes our work gets stuck due to some bugs in vc6.0 and here you can find some of the bug list :-

Sunday, July 02, 2006

Imp Values in Debugger

Value Usage
0xCDCDCDCD Allocated in heap, but not initialized
0xDDDDDDDD Released heap memory.
0xFDFDFDFD "NoMansLand" fences automatically placed at boundary of heap memory. Should never be overwritten. If you do overwrite one, you're probably walking off the end of an array.
0xCCCCCCCC Allocated on stack, but not initialized