Tuesday, June 14, 2005

C++'s One Definition Rule

The one definition rule of c++ is something I learnt and forgot several times, but it makes an interesting read every time!!

More links

The One-Definition Rule

Also see Weaving a Way Past the C++ One Definition Rule

3 comments:

kattricker said...

Pardon me but I am thinking why one would define an entity such as a class more than once, unless by mistake or perhaps when including two libraries where there is a name clash. Java embeds a convenient namespace mechanism in definition of class itself so duplicate definitions are caught at the file system or at compile time. And declaration and definition are the same in Java.

Balbir said...

The definition could be in a header, which in turn could be included by multiple c++ source files.

Balbir said...

Java's convention is good and smart, but it is also kind of limiting and painful at times. I also kind of like their directory parsing

a.b.c.d

for a/b/c/d

Ranking and Unranking permutations

I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...