看到一段关于 const 的讨论
摘录的一段:
My experience from other languages (C, C++, Objective C, Java, Smalltalk, etc) suggests that trying to add some notion of const to the language is detrimental. It's rarely of use to the compiler, adds little or no safety barrier for programmers, is confusing, and isn't always helpful documentation. I've seen grown men weep over C's const, and highly paid C++ professionals argue for hours over the meaning of const in C++.
The right place to annotate things with notions of constantness is the type hierarchy. See, for example, java.awt.Raster / java.awt.WritableRaster (from Java's 2D api), NSDictionary / NSMutableDictionary (from Objective-C's foundation classes).
drj
以为然也
Comments
Posted by: 天天基金网 | (7) February 11, 2008 05:40 AM
Posted by: cnzhangzhen | (6) June 16, 2006 03:12 PM
Posted by: Zenberg | (5) June 16, 2006 01:40 PM
Posted by: Zenberg | (4) June 16, 2006 01:34 PM
Posted by: nothanks | (3) June 16, 2006 10:10 AM
Posted by: xLight | (2) June 15, 2006 02:36 PM
Posted by: cnzhangzhen | (1) June 15, 2006 09:22 AM