"Tim Peters" <tim@zope.com> writes: > [Tim] >>> A non-broken compiler always allowd passing a >>> T >>> actual argument to a >>> const T >>> ... > > [David Abrahams] >> I don't know if C differs from C++ in this respect, but in C++, >> const in a prototype argument list has no effect whatsoever (unless >> modifying the referent of a pointer or reference). > > I meant T above to include cases like T = char*. > >> So: >> void f(const int x); >> is identical to >> void f(int x); > > Not in the presence of > > #define int char* > > it's not. Ouch. Now "int const" != "const int" (and I seriously can't think of any other problems with that #define. Macros to the rescue!!! ... uh, <wink>) > All seriousness aside, that's useful in C too, but rarely seen, since > the meaning of C code is always self-evident. Better than that. It always works perfectly and is trivial to write correctly. Who needs Python when we have C? > That said, I'm happy to add const decorations to Python's C API decls > where it helps C++ users, provided we get to stop about a thousand > miles short of making anyone truly happy. That sure would reduce the number of nasty casts we need to make. const_casts always set C++ users' teeth to chatterin'. > compromise-is-the-art-of-spreading-misery-ly y'rs - tim ...somewhat. -- David Abrahams dave@boost-consulting.com * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4