Z’s

July 16, 2008

Pointer To C++ Class Methods; Or Should You Call ’em “Method Pointers”?

This one is after a real long break from blogs :).
Function pointer is pretty commonplace among C/C++ developers unlike “pointer to C++ class methods.” For those who have never used it or even heard of it; it really is very similar to “Function Pointer” from outside, though its internal mechanism is entirely different and its syntax is quite ugly. So, without much literature, let’s see how one would make a pointer to a C++ method. Before that, let’s review the usual function pointer of C a little bit:

// define a function type FUNCTION that takes int and char* as argument

typedef int (*FUNCTION) (int, char*);

// Declare a funciton pointer f of type FUNCTION

// and make f point to some function that takes int and char* as argument.

FUNCTION f = some_function;

// Simply call the function with an int and char* argument

f(10,“Hello”);

So that’s how function pointers are dealt in C. Following is a snippet that shows how to declare a function pointer that points to a method of a C++ class and then finally shows how to call that method via the function pointer (or “method pointer,” if you like to call it that way):

(more…)

December 6, 2007

Exporting STL member variables in a DLL (C/C++)

Filed under: C/C++ — mdzahidh @ 9:35 am

Have you ever encountered one such dreaded warning messages ( warning C4251 ):

D:\Microsoft Visual Studio .NET 2003\Vc7\include\list(93) : warning C4251: ‘std::_List_nod<_Ty,_Alloc>::_Alnod’ : class ‘std::allocator<_Ty>’ needs to have dll-interface to be used by clients of class ‘std::_List_nod<_Ty,_Alloc>’
with
[
_Ty=Magick::Coordinate,
_Alloc=std::allocator<Magick::Coordinate>
]
and
[
_Ty=std::_List_nod<Magick::Coordinate,std::allocator<Magick::Coordinate>>::_Node
]
and
[
_Ty=Magick::Coordinate,
_Alloc=std::allocator<Magick::Coordinate>
]

And did you ever wonder what caused it or perhaps how to solve this warning problem. Honestly, I still could not figure out the right workaround with STL containers but found this Microsoft Link useful.

Happy Coding.

Z.

September 17, 2007

Can a Office Space Have “Karma”?

Filed under: Misc,Techs — mdzahidh @ 5:36 pm

I’m not a superstitious guy by any means but there are few things that never fail to intrigue me; they keep me pondering “does it really work that way?” Even at times I find myself doing things, rather subconsciously, I believe would bring me better luck just because it produced better results in the past. This would even include something as unrelated and silly as using “one particular type of” pen for my univ exams. Every time I thought it was mere stupid I would very soon find convincing myself “there’s nothing wrong in using this particular pen; and just in case it brings luck, you never know.” At other times, these things don’t really seem all that unrelated as they apparently do. For example, using “a particular type of” pen actually would make me more comfortable while writing and hence wouldn’t infuriate me during a lengthy exam; and my result vastly depended on the variation of my mood along the length of the exam.

I just came to know about one particular office building which has gained some name as having good “karma!” I didn’t know that companies like Google, PayPal and LogiTech kicked off as toddlers from the same office space! Can a office space really posses luck? Read this and be intrigued.

September 1, 2007

Interesting search strings for google

Filed under: Misc,Techs — mdzahidh @ 12:07 pm

Thanks a lot to Wasif who showed me these nice google search strings, whereby you can search stuffs on pages which you cannot access normally. For example you want to have a full mp3 song list of say Bryan Adams to be downloaded straight; you can use one of this search strings which will find the “index” pages that usually contain all the songs as normal file entries. Usually these index pages are not accessible from any websites. And guess what, it works and I already downloaded loads of stuffs :). Try it out :).

PS: If you know more google tricks, please let me know :).

August 30, 2007

1 Man with Visionary and 13 Men Made the Difference

Filed under: Game,Techs — mdzahidh @ 8:46 am

IdThis is for people who are genuinely interested in games. Even if you are not you are still most welcome aboard to be inspired by the tale of 13 men and 1 with visionary; the one who when speaks makes the game industry sit back and listen. This is the tale of John Carmack and his id software.

(more…)

August 28, 2007

Be Eclectic With Google Reader !

Filed under: Misc,Techs — mdzahidh @ 6:22 am

First of all let me thank Tahmid Bhai for introducing me with Google Reader. Since then I have kind of fallen in love with this yet-another-google-masterpiece (YAGM :p). The “My Shared Items” that you can see on the widget bar (Left or Right of this page, depending on the current theme) is just a manifestation of the Google Reader.

(more…)

August 24, 2007

A Little C/C++ Recipe You Can Live Without Knowing :)

Filed under: C/C++,Techs — mdzahidh @ 8:11 pm

Yes, read this if you are kind of bored or probably want to be too fussy about “How things work?” Have you ever wondered how compilers know how many instances of a class had been previously allocated when delete [] is called; because delete [] might have to traverse through each of the object and call their destructor. So it must be running some kind of loop right? But where does the compiler get the number of instances?
(more…)

August 16, 2007

What Makes You a Good C/C++ Coder?

Filed under: C/C++,Techs — mdzahidh @ 7:57 pm

Simple answer to this, perhaps, million dollar question is “Experience.” Now that’s vague enough to be applied to every other language on the planet. So what really does make someone a good C/C++ coder. Btw, do not even dare asking this question to Bjarne Stroustrup or Dennis Ritchie or perhaps guys like Linus Torvald 🙂 since they surely have their own definition of being “good” which comprise only themselves :).

Following is an excerpt of an email that I wrote to someone suggesting him which areas to explore to attend an interview for the game dev team at ReliSource Ltd:

(more…)

August 14, 2007

15 years to glory – wxWidget!

Filed under: Misc,Techs — mdzahidh @ 6:13 pm

1992, a guy from University of Edinburg was given the task to design a CASE (Computer Aided Software Engineering) tool to be run in both Windows and Linux system. At that point in time only a few cross platform GUI APIs were available and were very expensive for an university to spend on an in-house experimental tool. But that didn’t stop Julian Smart from designing his CASE tool. He realized that a cross-platform GUI has to be developed first and eventually wxWidget was conceived. Its is probably one of the most talked about Open-Source project after Linux itself !

(more…)

Create a free website or blog at WordPress.com.