Re: How do get a specific version of a particular file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.

In the end, we ended up using the C pre-processor (and some gcc hackery) 
instead, since it's just superior to the mess that is C++.

See "<asm/uaccess.h>" and various other header files, and realize that we 
have overloaded operations for things like "get_user()" and "xchg()" and 
friends.

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).

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.

Same largely goes for overloading of functions too, for that matter, 
except for the cases where you really can pretty much do it by argument 
size (and then the C preprocessor and few gcc extensions actually generate 
better and more readable code than C++ ever did - which is admittedly 
not saying a whole lot).

		Linus
-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]