[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Fri Feb 10 18:07:24 CET 2006
- Previous message: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification
- Next message: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jeremy Hylton wrote:
I added some const to several API functions that take char* but typically called by passing string literals. In C++, a string literal is a const char* so you need to add a constcast<> to every call site,
That's not true.
A string literal of length N is of type const char[N+1]. However, a (deprecated) conversion of string literals to char* is provided in the language. So assigning a string literal to char* or passing it in a char* parameter is compliant with standard C++, no const_cast is required.
Regards, Martin
- Previous message: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification
- Next message: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]