On 2/10/06, "Martin v. Löwis" <martin at v.loewis.de> wrote: > 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 const_cast<> 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. Ok. I reviewed the original problem and you're right, the problem was not that it failed outright but that it produced a warning about the deprecated conversion: warning: deprecated conversion from string constant to 'char*'' I work at a place that takes the same attitude as python-dev about warnings: They're treated as errors and you can't check in code that the compiler generates warnings for. Nonetheless, the consensus on the c++ sig and python-dev at the time was to fix Python. If we don't allow warnings in our compilations, we shouldn't require our users at accept warnings in theirs. Jeremy
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