[Python-Dev] Re: [Python-checkins] python/dist/src/Include
compile.h,2.38,2.39 parsetok.h,2.19,2.20 pyerrors.h,2.63,2.64
pythonrun.h,2.55,2.56 symtable.h,2.10,2.11
David Abrahams
dave@boost-consulting.com
Wed, 11 Dec 2002 15:44:39 -0500
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Include compile.h,2.38,2.39 parsetok.h,2.19,2.20 pyerrors.h,2.63,2.64 pythonrun.h,2.55,2.56 symtable.h,2.10,2.11
- Next message: [Python-Dev] Modules/tclNotify.c
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
"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
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Include compile.h,2.38,2.39 parsetok.h,2.19,2.20 pyerrors.h,2.63,2.64 pythonrun.h,2.55,2.56 symtable.h,2.10,2.11
- Next message: [Python-Dev] Modules/tclNotify.c
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]