Sunday, June 08, 2008

Definition of Programming

Programming is all about knowing when to boil the orange sponge donkey across the phillipines with an orangutang gorilla crossed with a ham sandwich to the fourth power of twelve across the nile with an awful headache from the previous night when all of alfred's naughty jalapeno peppers frog-marched the nordic elves across the loom-lined geronimo induced swamp donkey over and above the fortran fortified kilomanjaro fence past the meticulously crafted anti disgusting sponge cake scenario where all the hats doth quoteth the milk which is not unlike the super werewolf from the infinite realm of ninja-step. it's hard to define, really.

Something I found on a blog.... I don't have any comments for this one...hehe

Monday, June 02, 2008

Memory allocation in C++

All I had to do was read some content from Registry, but it was not all that simple, I had to read 1 registry, then use the content to read another string and then use it.

While doing all this, I didn't want to use static size buffers, so I started doing malloc(), but guess what malloc just refused to allocate 104 TCHARs, hmm then I tried HeapAlloc() and that was able to allocate the memory.

Different ways to allocate/de-allocate memory:

malloc HeapAlloc HeapCreate
calloc GlobalAlloc GetProcessHeap
realloc LocalAlloc HeapFree
new   HeapDestroy
    VirtualAlloc

small amount of memory should be allocated through malloc family. For bigger size user HeapAlloc, GlobalAlloc and LocalAlloc are available only for backward compatibility, so should not be used.

For more detail information on Managing Heap Memory in Win32, refer : http://msdn.microsoft.com/en-us/library/ms810603.aspx