Advertisement

Use defines in string? (c/c++)

Started by June 12, 2019 07:24 PM
10 comments, last by Bregma 5 years, 6 months ago
3 minutes ago, Green_Baron said:

But this is not a string conversion warning but a qualifier warning, right ?

Right.  In C++ a string literal is of type "char const*" and assigning a pointer to const to a pointer to non-const without casting away the constness is not alllowed in C++.  Before C++11 there was an exception to the rule for string literals to provide backwards compatibility with C90 (which did not have const at all) but C++11 only required compatibility with C99, which does have const, so the exception to the rule was removed.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement