Tuesday, February 28, 2006

On The Naming Away - I

The importance of the names that we give variables and functions cannot be overemphasized. I would even go so far as to say that, at times, proper naming is more important than the functionality being coded itself! Sadly, in the mad rush to get things working, this aspect of coding is often neglected. :-(

Remember: code is also for reading!

Sunday, February 19, 2006

Template Friend Functions

code snippet picked up from the net. don't remember where.


#include
using namespace std;
template
class SomeClass{
private:
T member;
public:
...
friend ostream& operator<<(ostream &,SomeClass &);
};

template
ostream& operator<<(ostream &os, const SomeClass&some){
os<<"( " << some.member <<") ";
return os;
}

int main(int argc, char* argv[])
{
SomeClass sc(5);
cout << sc; // Problem????
return 0;
}


It reported that operator << was not found.

The problem is that in the class definition, a friend was declared as a function, not a template function. To make the code link properly, the friend declaration should be changed to:

friend ostream& operator<< <>(ostream &,SomeClass &);


Just another little C++ twist.

Thursday, February 02, 2006

Attack Of The Clones

Presque vu: is a French term which means "almost seen". It is the feeling of very nearly, but not quite, remembering something.

Here are three operating system projects that attempt to recreate or provide the look-and-feel and user-experience of other operating systems. They are driven by fervent nostalgia, but could they, will they, ever be "even better than the real thing?

1. ReactOS - Aims to provide an implementation of a Windows® compatible OS
ReactOS homepage

2. Haiku - Aims at the re-creation of the Be Operating System.
Haiku OS homepage"

3. CoLinux - port of the Linux kernel that allows it to run alongside another operating system on a computer. Run Linux on Windows® 2000/XP.
Cooperative Linux Homepage