On Tue, 27 Feb 2007, Linus Torvalds wrote: > > > On Tue, 27 Feb 2007, Nicolas Pitre wrote: > > > > /me wonders why Linux wasn't written in C++ with overloaded operators... > > Actually, there was a short while that we tried it. I know. Amusing piece of history. > Overloading of operators wouldn't be very useful, though: it really only > pays in either real math (where having "+" etc do the right thing for > complex numbers/vectors/matrices/whatever is totally unambiguous and just > makes code a lot more readable) or with really trivial stuff (ie "+" for > string concatenation). Well... We could have >> and << to replace memcpy(), copy_to_user(), copy_from_user(), and select the appropriate method depending on whether one is a user space pointer. Or spin_lock++ and spin_lock--. Or written_data >> file >> filesystem, replacing all fops methods with operators as well. ;-) > Outside of math and really trivial stuff, it's just a horribly bad idea, > because it just makes for subtle and hard to understand code. Indeed. Well it can make the intent of the code clearer but certainly not its implementation. Nicolas - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html